Please Help with Code

diensatthan

Registered User.
Local time
Today, 14:45
Joined
Apr 27, 2003
Messages
14
Private Sub txtDate_BeforeUpdate(Cancel As Integer)

If IsDate(txtDate) Then
MsgBox "Valid Date entered" 'Msg1
Else
MsgBox "Invalid Date entered!" 'Msg2
End If

End Sub

The code above works OK for: a valid txtDate (Msg1 is displayed),
and an empty txtDate (Msg2 is displayed). However, if I entered "ABC" into the text box, I got an Access generic error message instead of the expected Msg2. Please help me with the date validation. Thanks.
 
I answered this question at another forum ....

But for those who may be curious:

This is a table level error and can not be trapped in the event you are using. It must be trapped using the Forms' "On Error" event (error 2113).

HTH
RDH
 
Thanks, R. Hicks.
 

Users who are viewing this thread

Back
Top Bottom