Error Event - Event Procedures

Error Event — Event Procedures

See Also         Example

To create an event procedure that runs when the Error event occurs, set the OnError property to [Event Procedure], and click the Build button .

Syntax

Private Sub Form_Error(DataErr As Integer, Response As Integer)

Private Sub Report_Error(DataErr As Integer, Response As Integer)

The Error event procedure has the following arguments.

Argument Description
DataErr The error code returned by the Err object when an error occurs. You can use the DataErr argument with the Error function to map the number to the corresponding error message.
Response The setting determines whether or not an error message is displayed. The Response argument can be one of the following intrinsic constants.
  Constant Description
  acDataErrContinue Ignore the error and continue without displaying the default Microsoft Access error message. You can supply a custom error message in place of the default error message.
  acDataErrDisplay (Default) Display the default Microsoft Access error message.

Remarks

You can't cancel the Error event.