views:

20

answers:

0

I have a save button on a form that does this (simplified):

If Not Me.Dirty Then GoTo Exit_
DoCmd.RunCommand acCmdSaveRecord

Exit_:
    Exit Sub

Err_:
    ' ... handle runtime error ...
    Resume Exit_

This form has its Error event handled in a custom class FormDataError.

Private WithEvents frm_ As Access.Form
...
Public Sub frm__Error(DataErr As Integer, Response As Integer)
    ... handle data errors ...
End Sub

In some cases, database (DAO) errors are trapped by FormDataError. But in other cases they are not.

For instance, an error 3314 (required field is Null) returned from DoCmd.RunCommand acCmdSaveRecord above does not trigger the Error event, and is treated like a normal runtime error, by the local error handler.

Any ideas why this would be happening? My understanding is that the Form Error event should supercede any local error handler, for database (DAO) errors.

(I made sure that the Form OnError = "[Event Procedure]", and FormDataError.frm_ does reference the form so it should receive error events from it.)