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

Error handling of incorrect image path

Status
Not open for further replies.

priac

Technical User
Feb 8, 2002
47
US
I have a table with several fields, one of which has the path to images of employees. I have the following code inserted into the form event for "on current". It works great and changes the picture, but if the path is incorrect ( typo) I get an error and the program goes down. How do I get the error to call a default image " c:\default.gif". I am not a programmer.

Private Sub Form_Current()
[Image_employee].Picture = [path]
End Sub
 
Try this:

Private Sub Form_Current()
On Error GoTo NoPic_Err

[Image_employee].Picture = [path]

NoPic_Err:
[Image_employee].Picture = "c:\default.gif"
Exit Sub

End Sub

Hope it helps
[yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top