Image control problem on report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi -

I have a weird problem that has turned out to be very frustrating. I have
an image control on a report that is set in the FORMAT event of the DETAIL
section. I am running the report in the PRINT PREVIEW mode, where each page
is a different record. The image file is set to a .bmp file residing on the
local hard drive. The problem is, for records where the filename being set
doesn't exist, it retains the image of the prior record where it did, instead
of displaying a blank. I would expect that if the .bmp file doesn't exist it
should display a blank.

Any ideas? Thanks a lot for any help!

Dan
 
Hi Doug -

The code I'm using is:

Me!myImage.Picture = myPath & myFileName & ".bmp"

It works fine as long as the file exists, but doesn't reset it to nothing if
it doesn't.


Thanks for your help -

Dan
 
If Len(Dir(myPath & myFileName & ".bmp")) > 0 Then
Me!myImage.Picture = myPath & myFileName & ".bmp"
Else
Me!myImage.Picture = vbNullString ' Or specify a default picture
End If
 
Hi Doug!

I have the same problem and tried your solution, but didn't work. I placed a
break point in the code at .Picture=vbNullString, but it is silently ignored.
It just keeps its previous value, in other words the value assigned when the
image was created. I am using Access 2002. Any ideas?

Thanks
Paul
 
Hi!
I got it after a little more experimenting! I deleted the original Image
control that had the full path in the Picture property because it would let
me delete it. I created a new Image control which of course forces you to
enter a path in Picture. I then attempted to delete the path, a confirmation
dialog opened, selected Yes. Picture now contains "(none)". From this point
on I am able to modify the property in code.

Thanks for the kickstart!
Paul
 
Back
Top