I am using the date picker built in function on an unbound text box.
In the text box propertyI set the format to short date and the show picker for dates.
When I enter a string or a non date number, the error "You have entered invalid data blah blah blah" fires. I would like to change this to my own message and remove the offending data and allow the user to reenter the requested information.
The problem is, even though I can trap the error on the forms on error event (error 2113) and send my own message and undo the text - the standard error message still fires.
I can't seem to resolve this. Here is the code I have to trap the error on the on error event of the form.
attached is a sample of this error on a form. Enter a date or null and leave control all is fine.. enter a string and watch the fun.
I must be missing something.. any thoughts?
In the text box propertyI set the format to short date and the show picker for dates.
When I enter a string or a non date number, the error "You have entered invalid data blah blah blah" fires. I would like to change this to my own message and remove the offending data and allow the user to reenter the requested information.
The problem is, even though I can trap the error on the forms on error event (error 2113) and send my own message and undo the text - the standard error message still fires.
I can't seem to resolve this. Here is the code I have to trap the error on the on error event of the form.
Code:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Select Case DataErr
Case 2113
Dim varRet
varRet = MsgBox("You must enter a date in text box!", vbOKOnly)
If varRet = vbOK Then Me.Text0.Undo
Case Else
MsgBox "The form error, " & DataErr & " has occurred.", vbOKOnly, "Error"
End Select
End Sub
attached is a sample of this error on a form. Enter a date or null and leave control all is fine.. enter a string and watch the fun.
I must be missing something.. any thoughts?