Linked Images in Reports

RDSJMS

Registered User.
Local time
Today, 15:47
Joined
Jan 25, 2006
Messages
30
I have a products DB with up to 4 images per product: (1) how it is packaged in the box; (2) how the boxes are stacked on a pallet; (3) the label that goes on the product itself; (4) the label that goes on the pallet. Not all products have all 4 images.

I use linked images to display the images on the report, but I don't want to populate any of the linked fields with a null image, rather I want to have code display the image only if the text control is populated.

It would seem like I need some type of looping code to check for a populated linked image field, but I am not good with VBA.

I have searched the forums but have not found the specific problem I have.

Can anyone assist me with this please.
 
Linked Images in Report

Can anyone help me with this please? This is the code I have in the report:


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Image1.Picture = Me.txtImage1Path
Me.Image2.Picture = Me.txtImage2Path
Me.Image3.Picture = Me.txtImage3Path
Me.Image4.Picture = Me.txtImage4Path

End Sub


When any of the txtImage#Path are null, I get a Run-time error '13': Type mismatch.

I really do not want to have to put a path to a blank image in any of the txtImage#Path's that do not contain an image. I need to know how to get Access to recognize that there is no path and work with that without the run-time error.
 
Just test to see if it is null first and assign the value if it isn't null.

Code:
If Not IsNull(Me.txtImage1Path) Then
    Me.Image1.Picture = Me.txtImage1Path
end If

If Not IsNull(Me.txtImage2Path) Then
    Me.Image2.Picture = Me.txtImage2Path
End If
... and so on...
 
Bob,

Thank you. It was so simple it's embarrassing.

Randy
 

Users who are viewing this thread

Back
Top Bottom