Photo on Report error

  • Thread starter trevorC via AccessMonster.com
  • Start date
T

trevorC via AccessMonster.com

Hi All,
The code below is putting a photo on my report but puts the same photo until
it gets a new one then changes to that until a different one is listed in the
dlookup.
Any ideas whould be great.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Not IsNull(DLookup("[Employee Photo]", "[Employees]", "Reports![employee
barcode cards]![Barcode] =[Barcode]")) Then
Me.employee_photo.Picture = DLookup("[Employee Photo]", "[Employees]",
"Reports![employee barcode cards]![Barcode] =[Barcode]")
Else
Me.employee_photo.Picture = ""
End If
End Sub
 
L

Larry Linson

You are correct that the Control will show the same picture until that is
replaced by another picture; a pictur property that is a zero-length string
is not "another picture" -- this is not an error; it is "working as
designed". One rather simple solution is to store a one-pixel image file of
the background color in records which do not have an image file, or use the
name of that image file in the Else clause of your code instead of setting
the Picture property to "".

Larry Linson
Microsoft Office Access MVP
 
T

trevorC via AccessMonster.com

Thanks for the reply Larry.
I'll use your idea and fix it up thanks.

Larry said:
You are correct that the Control will show the same picture until that is
replaced by another picture; a pictur property that is a zero-length string
is not "another picture" -- this is not an error; it is "working as
designed". One rather simple solution is to store a one-pixel image file of
the background color in records which do not have an image file, or use the
name of that image file in the Else clause of your code instead of setting
the Picture property to "".

Larry Linson
Microsoft Office Access MVP
Hi All,
The code below is putting a photo on my report but puts the same photo
[quoted text clipped - 14 lines]
End If
End Sub
 

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