Time Error Trap

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using the following code in the forms On Error Event, but I still get a
system generated error and not my message box. Any help is appreciated....

--------------------
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 2279 Then
MsgBox "Please enter the Time in proper 24 hour format"
Response = acDataErrContinue
End If
End Sub
 
You will not get you error message using the On Error event of the form.
Below is an excerpt from VBA Help regarding that event:

The Error event occurs when a run-time error is produced in Microsoft Access
when a form or report has the focus. This includes Microsoft Jet database
engine errors, but not run-time errors in Visual Basic.

The error you are receiving is VB run-time error. You would be better
served to use error handling code in all your procedures. This approach will
capture almost all errors. Look up the On Error statement in VBA Help. It
should give you all the info you need to solve this problem.
 
Back
Top