photo display in a report

G

Guest

I am using the following code in the report.detail.format method

If Len(Me![PhotoPath]) <> 0 Then
If Len(Dir(PhotoPath)) = 0 Then
Me![Photofield].Picture = ""
Else
Me![Photofield].Picture = Me![PhotoPath]
End If
Else
Me![Photofield].Picture = ""
End If

When a the PhotoPath field is blank (because the photo does not exist), the
photo from the previous record is printed. How can I correct this problem?

Thanks
 
F

fredg

I am using the following code in the report.detail.format method

If Len(Me![PhotoPath]) <> 0 Then
If Len(Dir(PhotoPath)) = 0 Then
Me![Photofield].Picture = ""
Else
Me![Photofield].Picture = Me![PhotoPath]
End If
Else
Me![Photofield].Picture = ""
End If

When a the PhotoPath field is blank (because the photo does not exist), the
photo from the previous record is printed. How can I correct this problem?

Thanks

Are you using an Image control for this?
One way...
If Len(Me![PhotoPath]) <> 0 Then
If Len(Dir(PhotoPath)) = 0 Then
Me![Photofield].Visible= False
Else
Me![Photofield].Visible= True
Me![Photofield].Picture = Me![PhotoPath]
End If
Else
Me![Photofield].Picture = False
End If

Second way...

If Len(Me![PhotoPath]) <> 0 Then
If Len(Dir(PhotoPath)) = 0 Then
Me![Photofield].Picture = "(none)"
Else
Me![Photofield].Picture = Me![PhotoPath]
End If
Else
Me![Photofield].Picture = "(none)"
End If

I would go with the Visible/Not Visible method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top