Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Image control problem on report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan - 02 Nov 2006 21:29 GMT
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
Douglas J. Steele - 02 Nov 2006 21:50 GMT
What's the code you're using to set the image?

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Hi -
>
[quoted text clipped - 15 lines]
>
> Dan
Dan - 02 Nov 2006 22:14 GMT
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

> What's the code you're using to set the image?
>
[quoted text clipped - 17 lines]
> >
> > Dan
Douglas J. Steele - 02 Nov 2006 22:38 GMT
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

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Hi Doug -
>
[quoted text clipped - 35 lines]
>> >
>> > Dan
Dan - 02 Nov 2006 23:36 GMT
Thanks a lot, Doug.  That did it.

I appreciate your help.

Dan

> If Len(Dir(myPath & myFileName & ".bmp")) > 0 Then
>    Me!myImage.Picture = myPath & myFileName & ".bmp"
[quoted text clipped - 41 lines]
> >> >
> >> > Dan
Paul - 14 Nov 2006 21:54 GMT
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

> If Len(Dir(myPath & myFileName & ".bmp")) > 0 Then
>    Me!myImage.Picture = myPath & myFileName & ".bmp"
[quoted text clipped - 41 lines]
> >> >
> >> > Dan
Paul - 15 Nov 2006 14:26 GMT
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

> Hi Doug!
>
[quoted text clipped - 51 lines]
> > >> >
> > >> > Dan
Paul - 15 Nov 2006 20:38 GMT
Oops  a typo; should have read 'because it would NOT let me delete it". Sorry!

> Hi!
> I got it after a little more experimenting! I deleted the original Image
[quoted text clipped - 62 lines]
> > > >> >
> > > >> > Dan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.