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!

Image Problems

Status
Not open for further replies.

Steve1001

Technical User
Nov 1, 2002
17
US
Hi

I have a report that has a picture linked to a remote drive. The appropriate picture is displayed linked to the item number on the form. This is fine if the correct picture exists, but if not, I just get an error message saying that the file can't be found. The code is very simple


Photo.Picture = "r:\gallery\" & Me.imast_drawno & ".jpg"

What code do I need to add, so that if the picture (imast_drawno )does not exist in r:\gallery ? I would like to be able to disply a default (NP)which is just a caption saying "picture not available" I have tried various code but none work!
Many thanks

Steve
 
Use error trapping (On Error GoTo...):

Sub Whatever()
On Error GoTo DefaultPic
Photo.Picture = "r:\gallery\" & Me.imast_drawno & ".jpg"

FinishPoint:
Exit Sub

DefaultPic:
Photo.Picture = "r:\gallery\NotAvailable.jpg"
Resume FinishPoint
End Sub

HTH

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top