Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Linked Images in a Report

Access Howto:

Print Linked Images in a Report

by  AirPro  Posted    (Edited  )
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.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top