Click Event -- Macros

Description

To run a macro when the Click event occurs, set the OnClick property to the name of the macro.

Remarks

You often use Click macros to carry out the actions for each command button on a form. For example, by clicking one command button on a form, users can print a report showing the form’s records. By clicking another, they can open a related form.

For a command button only, Microsoft Access runs the macro specified by the OnClick property when the user chooses the command button by pressing the Enter key or an access key. The macro runs once. If you want the macro to run repeatedly while the command button is pressed, set its AutoRepeat property to Yes. For other types of controls, you must click the control using the mouse button to trigger the Click event.

You can’t use the CancelEvent action in a Click macro.

See Also

Click Event — Event Procedures.