Share via

PictureData Property [Access 2003 VBA Language Reference]

You can use the PictureData property to copy the picture in a form, report, or control to another object that supports the Picture property. Read/write Variant.


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


The PictureData property setting is the PictureData property of another image control, command button, toggle button, form, or report.

You set this property by using Visual Basic .

You can use this property to display different background pictures in a form, depending on actions taken by the user. For example, you might open a Customers form using a different background picture depending on whether the form is opened for data entry or for browsing.

You can also use the PictureData property together with the Timer event and the TimerInterval property to perform simple animation on a form.


The following example uses three image controls to animate a butterfly image across a form. The Hidden1 image control contains a picture of a butterfly with its wings up and the Hidden2 image control contains a picture of the same butterfly with its wings down. Both image controls have their Visible property set to False. The TimerInterval property is set to 200. Each time the Timer event occurs, the picture in the image control Visible1 is changed by using the PictureData property of the hidden image controls, and the visible image control is moved 200 twips to the right. The visible image control is moved back to the left side of the form when its Left property value is greater than the width of the form stored in the public variable gfrmWidth. The value of gfrmWidth is set to Me.Width in the form's open event.

Private Sub Form_Timer()

    Static intPic As Integer

    Select Case intPic
        Case Is = 1
            Me!Visible1.PictureData = Me!Hidden1.PictureData
        Case Is = 2
            Me!Visible1.PictureData = Me!Hidden2.PictureData
        Case Else
    End Select

    If intPic = 2 Then intPic = 0
    intPic = intPic + 1
    If (Me!Visible1.Left > gfrmWidth) Then Me!Visible1.Left = 0
    Me!Visible1.Left = Me!Visible1.Left + 200

End Sub

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

See Also | Picture Property | PictureAlignment Property | PicturePages Property | PictureSizeMode Property | PictureTiling Property | PictureType Property