Error

The Error event occurs when there is a problem accessing data for the form. Use this event to suppress the standard error messages and display a custom error message instead.

The Error event takes the following two arguments: DataErr — Contains the number of the Microsoft Access error that occurred.

Response — Determines whether or not error messages should be displayed. It may be one of the following constants:

acDataErrContinue — Ignore the error and continue without displaying the default Microsoft Access error message. acDataErrDisplay — Display the default Microsoft Access error message. This is the default.

Event Programming in Forms and Reports

The event procedure in Hands-On 24-17 displays a custom message when an attempt is made to add a new record with a customer ID that already exists.

The standard Microsoft Access error message is not displayed.

0 0

Post a comment