How to code:
This code loads a picture from the local or network hard drive into an image control based on a Picture ID stored in a table.
Steps
1. Create a report
2. Add an Image control to the 'Details' section of the report
3. After selecting an image file as required by the image control wizard; delete it and set the image format properties to "linked" and "zoom".
Next double click the Details Section line so the "Detail" Properties box shows.
In the Detail_Format event (near the bottom) click it, so "Event Procedure" shows; then click the "3 dots" button to view the VBA code window
Next paste this line in as shown below
Me!Image(insert image number).Picture = "F:\path to your pictures\" & Me![field on the report that has a unique Picture ID] & ".jpg" (or other specified file type)
Here is an example from my report:
Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)
Me!Image74.Picture = "F:\DIVISION\AQD\Photos\" & Me![PHOTO.PHOTO_ID] & ".jpg"
End Sub
Now when you view the report it should show the associated linked picture for each record.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.