| | |
|
|
|
date validation |
| message from helena on 12 May 2004 |
I have an unbound date field that is
masked "99/99/0000;0;_" (short date). What I want is to
provide my own error message instead of using the default
system error message. Where does the error "trigger" when
an invalid date is entered. How can I bypass the system
error message and provide my own?
|
| fredg replied to helena on 12 May 2004 |
Trap the error in the Form's Error event:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 2279 Then
Response = acDataErrContinue ' Don't display the default message
MsgBox "Please re-enter the correct code"
Else
Response = acDataErrDisplay ' Display Default message
End If
End Sub
|
| helena replied to fredg on 13 May 2004 |
Trapping from the Form_Error event works...thanks
My next related question is...how can I reference
the "errant" field (text box) to reset the field
to blank? There are multiple date fields on the
form.
Thanks,
Helena
to
default
when
system
Integer)
default message
message
|
| fredg replied to helena on 13 May 2004 |
Add a line of code:
Response = acDataErrContinue ' Don't display the default message
MsgBox "Please re-enter the correct code"
Me.ActiveControl = " " ' ** Add this line **
Else
etc.
|
|
Archived message: date validation (Microsoft Access Database)