I have a form where a user enters a name, date and name of a picture file that is found in a directory. Then, they click [submit] in which the record is added and a new form is opened so they can add additional information with the picture showing. However, if the name is misspelled the picture will go to the first picture in the directory (by default) even though the record is the correct one.
How do you trap and send a message if the path of the picture is not found? Right now, on the "on current" event of the form where the user enters additional information, this is what is there:
Private Sub Form_Current()
On Error Resume Next
Me![ImageFrame].Picture = Me![ImagePath]
End Sub
----------------------------------------------------------------
I tried this:
Private Sub Form_Current()
On Error GoTo PicDoesNotMatch
PicDoesNotMatch:
MsgBox "The picture name does not match. Make sure the picture is loaded and named exactly the same"
Me.fldImagePath.SetFocus
Exit Sub
Me![ImageFrame].Picture = Me![ImagePath]
End Sub
-------------------------------------------------------
But, even if the pic is correct, it doens't give me the correct pic to match the record. And because this form is opened by code on the previous form, it gives me the message numerous times which is annoying. There has to be a better way. I would prefer to catch that on the form where the initial data is entered before it even opens the second form where the additional data is entered.
Thanks!