[AccessD] Intercept a date format error

Joshua B lists at jbsolutions.com.au
Tue Aug 26 01:16:47 CDT 2003


Hi  David:

That error actually needs to be trapped at the form level, something like this...

Private Sub Form_Error(DataErr As Integer, Response As Integer)
Select Case DataErr
    Case 2113
        MsgBox "Wrong date format!"
        Response = acDataErrContinue
End Select
End Sub



======== At 2003-08-26, 15:31:00 you wrote: ========

I know this has been mentioned before but I couldn’t find the solution.

I have an unbound textbox control on a form which will receive a date. I have set the format property of the control to ‘Medium date’
I deliberately type in a ridiculous date to force the following error:

“The value you entered isn’t valid for this field”.

I want to intercept this error and replace the message box with my own, but no event seems to be triggering – it’s almost as if Access checks the format before any other event is triggered and I cannot get to that event. 

Please don’t tell me I have to remove the format and parse the entered text (date) in a custom procedure!!!

Hopefully someone has solved this one and can point me to the solution.
Cheers 
David Ô¿Ô¬ 
Brisbane Australia 


= = = = = = = = = = = = = = = = = = = = = =
Best regards. 

Joshua B                
lists at jbsolutions.com.au 
www.jbsolutions.com.au               
2003-08-26                




More information about the AccessD mailing list