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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deal with errors when image doesn't yet exist

Status
Not open for further replies.

tvsmvp

Technical User
Aug 17, 2006
59
US
When I'd like to load an image onto a form, how do I deal with the error that results when the image doesn't exist? I can exit the sub based on "on error" - but that won't work when there are several images on the page (because each has its own error message).

As you can see, I've templatized the names and locations of the images (path + state name + file suffix) - but what to do when the image doesn't exist yet?

Dim fName2 As String
errormsg.Visible = False
fName2 = "C:\Documents and Settings\ ... \images\" & StateAbbreviated.Value & "-tb.gif"
Me![State-tb].Picture = fName2
showImageFrame
errormsg.Visible = False
Me.PaintPalette = Me![State-tb].ObjectPalette

Any suggestions? (would be much appreciated)
 
Have a look at the Dir function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top