Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

more access image form help please

Status
Not open for further replies.

boiker

Technical User
Oct 19, 2001
17
US
this is my problem. i have a databse that access linked images utilizing code found here.

Me!Image.Picture = "s:\pgm\historic pictures\" & Me![Current Address] & ".jpg"

piclabel.Caption = "File: " & " s:\pgm\historic pictures\" & Me![Current Address] & ".jpg"

that code obviously compares the address field to a path with that same address in it.

now, some of my records do not have pictures.
i want access to do the following

if a picture with current address.jpg can't be found in the directory, load nopicavail.jpg, else perform the above code.

i don't know how to do this, and my is department decided not to include the vb online help file when they installed access.

Thanks

 

If I understand this, then the path name for the jpg file is stored in a table in the field [Current Address]?

If that is true, then couldn't you specify the path to your 'no pic' picture in the [Current Address] field if no other picture was avaliable?

That way you can use the code you already have.

Or did I miss something (wouldn't be the first time..) :)
 
GOT IT! Thanx for you help guys. i knew i needed an if else statement, but i didn't know how i was going to use it. I didn't want to put no pic in the current address field because i will still print reports using that address. now, when i do add a pic with the right address, the database will find that address's pic and not use the image missing graphic.

Private Sub Form_Current()

Dim retfile As String

retfile = Dir$("s:\pgm\historic pictures\" & Me![Current Address] & ".jpg")

If retval = Me![Current Address] & ".jpg" Then

Me!Image.Picture = "s:\pgm\historic pictures\" & Me![Current Address] & ".jpg"
piclabel.Caption = "File: " & " s:\pgm\historic pictures\" & Me![Current Address] & ".jpg"

Else

Me!Image.Picture = "s:\pgm\historic pictures\imagenotavail.jpg"
piclabel.Caption = "IMAGE NOT CURRENTLY AVAILABLE"

End If

End Sub
 
I believe so Beren1h...
I still think he will need an

IF...ELSE statement to accomplish this. I miss stuff all the time...hehehe : )
 
if the file doesn't exist does it not return an error. I would trap for the error.

On Error DisplayImageNotAvailable

me!image.picture = "imagenotavailable.jpg"

This make sense becuase even if there is network problems you could have this image displayed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top