You can use the Picture property to specify a bitmap (bitmap: A picture made from a series of small dots, much like a piece of graph paper with certain squares filled in to form shapes and lines. When stored as files, bitmaps usually have the extension .bmp.) or other type of graphic to be displayed on a command button (command button: A control that runs a macro, calls a Visual Basic function, or runs an event procedure. A command button is sometimes called a push button in other programs.), image control (image control: A control that is used to display a picture on a form or report.), toggle button (toggle button: A control that is used to provide on/off options on a form or report. It can display either text or a picture, and can be stand-alone or part of an option group.), page on a tab control (tab control: A control that you can use to construct a single form or dialog box that contains several pages, each with a tab, and each containing similar controls, such as text boxes or option buttons. When a user clicks a tab, that page becomes active.) or as a background picture on a form (form: An Access database object on which you place controls for taking actions or for entering, displaying, and editing data in fields.) or report (report: An Access database object that you can print, which contains information that is formatted and organized according to your specifications. Examples of reports are sales summaries, phone lists, and mailing labels.). Read/write String.
expression Required. An expression that returns one of the objects in the Applies To list.
The Picture property contains (bitmap) or the path and file name of a bitmap or other type of graphic to be displayed.
You can set this property by using:
- The property sheet (property sheet: A pane that is used to view or modify the properties of various objects such as tables, queries, fields, forms, reports, data access pages, and controls.). Click the Build button to the right of the property box (for command buttons and toggle buttons). When you select one of the bitmap files from the Available Pictures list, the property setting is (bitmap).
- A macro (macro: An action or set of actions that you can use to automate tasks.).
- Visual Basic for Applications (VBA) (Visual Basic for Applications (VBA): A macro-language version of Microsoft Visual Basic that is used to program Microsoft Windows-based applications and is included with several Microsoft programs.) code. You can use a string expression (string expression: An expression that evaluates to a sequence of contiguous characters. Elements of the expression can be: functions that return a string or a string Variant (VarType 8); a string literal, constant, variable, or Variant.) that includes the path and the name of the graphic, as in the following example:
btnShowLogo.Picture = "C:\Windows\Winlogo.bmp"
- The Image command under Controls and Fields on the Design tab in Design view (for image controls or background pictures on forms and reports) to select a bitmap or other type of graphic.
The default setting is (none). After the graphic is loaded into the object, the property setting is (bitmap) or the path and file name of the graphic. If you delete (bitmap) or the path and file name of the graphic from the property setting, the picture is deleted from the object and the property setting is again (none).
If the PictureType property is set to Embedded, the graphic is stored with the object.
You can create custom bitmaps by using Microsoft Paintbrush or another application that creates bitmap files. A bitmap file must have a .bmp, .ico, or .dib extension. You can also use graphics files in the .wmf or .emf formats, or any other graphic file type for which you have a graphics filter. Forms, reports, and image controls support all graphics. Command buttons and toggle buttons only support bitmaps.
Buttons can display either a caption or a picture. If you assign both to a button, the picture will be visible, the caption won't. If the picture is deleted, the caption reappears. Microsoft Office Access 2007 displays the picture centered on the button and clipped if the picture is larger than the button.
To create a command button or toggle button with a caption and a picture, you could include the desired caption as part of the bitmap and assign the bitmap to the Picture property of the control.
The following example sets the background picture "Logo.gif" for the "Purchase Order" report.
Reports("Purchase Order"). = _