Images in reports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table in Access 2000. One field has a path to my hdd to the images,
e.g. c:\dir\images\ddd.jpg etc... for each record.

How do I reference this image on my hdd so that the image is displayed in
the Report.

skc
 
Include the field containing the path to your images in your report, and set
it to not be visible; also include an ImageControl where you want the image
to appear. Put the following code in the On Format event of the report
section in which the image is to be displayed:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.PictureFilename <> vbNullString Then
Me.imgPicture.Picture = pathname & Me.PictureFilename
Me.imgPicture.Visible = True
Else
Me.imgPicture.Visible = False
End If
End Sub

The above assumes that the image is to appear in the detail section, that
the field containing the filename is called PictureFilename, and that the
ImageControl is called imgPicture. Change to suit.

HTH,

Rob
 
Back
Top