Hi, I've run into a snag here and hopefully someone here can help. Basically what I'm trying to do is set it up so the user only needs to place a properly formatted picture in a directory to get it to show up in the report. The problem I'm running into is that each record shows up on two or more pages, when I have my code set to run on current it never runs, so I've tried to run the code on page, the problem is that as soon as I get to the next page, the ProductID shows up as the next record on the list, not the current one. What really makes it confusing is that the rest of the information on the page is still for the correct item. Thanks in advance for any help you can offer.
Code:
Private Sub Report_page()
Dim Picture1 As String
Dim Picture2 As String
Dim Picture3 As String
Dim Picture2Genus As String
Dim Picture3Genus As String
Picture1 = "P:\Lab Pictures\" & ProductID & "Stock.jpg"
Picture2 = "P:\Lab Pictures\" & ProductID & "St2.jpg"
Picture3 = "P:\Lab Pictures\" & ProductID & "St3.jpg"
Picture2Genus = "P:\Lab Pictures\" & Left(ProductID, 3) & "St2.jpg"
Picture3Genus = "P:\Lab Pictures\" & Left(ProductID, 3) & "St3.jpg"
If Dir(Picture1) = "" Then 'Checks for Stock Picture
Me!Image1.Picture = "P:\AccessPics\nopic.bmp"
Else
Me!Image1.Picture = Picture1
End If
If Dir(Picture2) = "" Then 'Checks for Stage 2 Picture
If Dir(Picture2Genus) = "" Then 'Checks for Genus Stage 2Picture
Me!Image2.Picture = "P:\AccessPics\nopic.bmp"
Else
Me!Image2.Picture = Picture2Genus
End If
Else
Me!Image2.Picture = Picture2
End If
If Dir(Picture3) = "" Then 'Checks for Stage 3 Picture
If Dir(Picture3Genus) = "" Then 'Checks for Genus Stage 3 Picture
Me!Image3.Picture = "P:\AccessPics\nopic.bmp"
Else
Me!Image3.Picture = Picture3Genus
End If
Else
Me!Image3.Picture = Picture3
End If
End Sub
Comment