Run a macro or event procedure for an event on a form, report, or control

Run a macro or event procedure for an event on a form, report, or control

Microsoft Access responds to many types of events on forms, reports, and controls, including mouse clicks, changes in data, and forms or reports being opened or closed.

  1. Open the form or report in Design view.

  2. Create a macro or an event procedure. For example, you can create a macro or event procedure that displays a message when you click a command button.

  3. Set the appropriate event property of the form, report, or control to the name of the macro, or to [Event Procedure] if you're using an event procedure.

    For example, to use a macro to display a message when you click a command button, set the command button's OnClick property to the name of a macro that displays the message. To use an event procedure, create a Click event procedure for the command button, and then set its OnClick property to [Event Procedure].

Notes