I have a form in Access 2003, it has a unbound date field where the user enters a date and then presses either 'Continue' that opens a report based on the criteria in the date filed, or 'Cancel' that closes the form.
The problem I have is that if the user enters '2' in the unbound date field or any other value that is not a valid date, he gets the following massage 'The value you entered isn't valid for this field', but I wanted to be able to (1) replace it with my own massage and (2) reset the value of the filed to "" so that the user can either enter a new date or cancel.
I was able to replace the massage with my own using the following code:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Const INPUTMASK_VIOLATION = 2113
If DataErr = INPUTMASK_VIOLATION Then
MsgBox "The Date you have enterd is not valid, please enter a valid Date, or Cancel.", vbInformation
Response = acDataErrContinue
But I wasn't able to reset the value lin the date filed to "" so that the user can either enter a correct date or cancel, so if the user wants to cancel, he / she must first delete the '2' or whAtever wrOng value thaye had in it and then cancel; how would I do that ?