You can do what you describe using an Image
control and a line of VBA code. For a sample table named [ImageLocations]
ImageLocation
-----------------------------------
\SERVERPublicPicturesimage1.jpg
\SERVERPublicPicturesimage2.jpg
I created a report with that table as the Record Source
, dropped the [ImageLocation] field onto the Detail band, and added an Image
control. I used the following as the On Format
event of the report's Detail section:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.ImageControl.Picture = Me.ImageLocation.Value
End Sub
When I print the report I see the images associated with the filenames in the table.
Edit re: comment
Newer versions of Access (since at least Access 2010) do not need the On Format
VBA code. We can simply place an Image
control on the report and set its Control Source
property to the (text) field containing the path to the image file. Thanks to Albert D. Kallal for the tip!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…