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.
- Open the form or report in Design view.
- 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.
- 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
- For information on creating a macro, click
- For information on creating an event procedure, click .
- For information on when events occur, click .