Picture Property [Access 2003 VBA Language Reference]

You can use the Picture property to specify a bitmap or other type of graphic to be displayed on a command button, image control, toggle button, page on a tab control or as a background picture on a form or report. Read/write String.

expression.Picture

expression Required. An expression that returns one of the objects in the Applies To list.

Remarks

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 . 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 .

  • Visual Basic . You can use a string expression that includes the path and the name of the graphic, as in the following example:

    btnShowLogo.Picture = "C:\Windows\Winlogo.bmp"
    
  • The Picture command on the Insert menu (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 Access displays the picture centered on the button and clipped if the picture is larger than the button.

Tip

Picture

Example

The following example sets the background picture "Logo.gif" for the "Purchase Order" report.

Reports("Purchase Order").Picture = "C:\Picture Files\Logo.gif"
   

Applies to | CommandButton Object | Form Object | Image Object | Page Object | Report Object | ToggleButton Object

See Also | Caption Property | HyperlinkAddress Property | PictureAlignment Property | PictureData Property | PictureSizeMode Property | PictureTiling Property | PictureType Property