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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying a linked image in a report

Status
Not open for further replies.

hdog

Technical User
Mar 24, 2002
26
US
I'm trying to display a linked image in a report. To avoid the need to change multiple forms/reports whenever a graphic location changes, I have created a table with path's to the appropriate graphic types. By simply changing the path in the table, the forms/reports should find the images. I am using the following code to display the images:

Private Sub Display_Pic()
On Error GoTo Err_Display_Pic
Me!Bride_Groom_Frame.Visible = True
Me!Bride_Groom_Frame.Picture = Me![Path] & [Registry_ID] & ".jpg"
Exit Sub

Err_Display_Pic:
Me!Bride_Groom_Frame.Picture = Me![Path] & "Bride_Groom" & ".jpg"
Exit Sub

I have the Path field in my forms and reports as a hidden field that references the path of the images from the table. This works fine in my forms but for some reason doesn't work in my reports. Access responds that it can't find the path specified. When I look at the information in the hidden path field on the report it is pointing to the correct location (although it doesn't show underline characters). Do report fields not work the same as form fields? I'm confused.

Thanks for the help in advance!
 
Probably more elegant ways to do this, but one approach might be to create 3 image objects in the same place on the report, each with the appropriate image embedded. Depending on the value of [Registry_ID], set the appropriate image visible property to true.

For example, in the on print event of the report detail section:

Select Case Me.Registry_ID
Case Is "1"
Me!Bride_Groom_Frame.Picture1.Visible = True
Me!Bride_Groom_Frame.Picture2.Visible = False
Me!Bride_Groom_Frame.Picture3.Visible = False
Case Is "2"
Me!Bride_Groom_Frame.Picture1.Visible = False
Me!Bride_Groom_Frame.Picture2.Visible = True
Me!Bride_Groom_Frame.Picture3.Visible = False
Case Else
Me!Bride_Groom_Frame.Picture1.Visible = False
Me!Bride_Groom_Frame.Picture2.Visible = False
Me!Bride_Groom_Frame.Picture3.Visible = True
End Select


Hopefully this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top