Time Error Trap

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top