Click Event

Applies To

Bound Object Frame Control, Chart Control, Check Box Control, Combo Box Control, Command Button Control, Form, Form Section, Image Control, Label Control, List Box Control, Option Button Control, Option Group Control, Rectangle Control, Subform/Subreport Control, Text Box Control, Toggle Button Control, Unbound Object Frame Control.

Description

The Click event occurs when the user presses and then releases a mouse button over an object.

Notes

  • The Click event applies only to forms, form sections, and controls on a form.
  • This event doesn’t apply to check boxes, option buttons, or toggle buttons in an option group. It applies only to the option group itself.
  • This event doesn’t apply to a label attached to another control, such as the label for a text box. It applies only to “freestanding” labels. Clicking an attached label has the same effect as clicking the associated control. The normal events for the control occur, not any events for the attached label.

Remarks

On a form, this event occurs when the user clicks a blank area of the form or a disabled control on the form.

For a control, this event occurs when the user:

  • Clicks a control with the left mouse button. Clicking a control with the right or middle mouse button does not trigger this event.
  • Selects an item in a combo box or list box, either by pressing the arrow keys and then pressing the ENTER key or by clicking the mouse button.
  • Presses the SPACEBAR when a command button, check box, option button, or toggle button has the focus.
  • Presses the ENTER key on a form that has a command button whose Default property is set to Yes.
  • Presses the ESC key on a form that has a command button whose Cancel property is set to Yes.
  • Presses a control’s access key. For example, if a command button’s Caption property is set to &Go, pressing ALT+G triggers the event.

Typically, you attach a Click event procedure or macro to a command button to carry out commands and command-like actions. For the other applicable controls, use this event to trigger actions in response to one of the occurrences discussed earlier in this topic.

The Click event for an option group occurs after you change the value of one of the controls in the option group by clicking the control. For example, if you click a toggle button, option button, or check box in an option group, the Click event for the option group occurs after the BeforeUpdate and AfterUpdate events for the option group.

The Click event for a command button occurs when you choose the command button. In addition, if the command button doesn’t already have the focus when you choose it, the Enter and GotFocus events for the command button occur before the Click event.

When a Click event occurs for a list box, the following related events also occur, in this order:

MouseDown MouseUp Click

Other controls have a similar order of events.

Double-clicking a control causes both DblClick and Click events to occur. For command buttons, double-clicking triggers the following events, in this order:

Click DblClick Click

You can use a CancelEvent action in a DblClick macro to cancel the second Click event. For more information, see the DblClick event topic.

Tip To distinguish between the left, right, and middle mouse buttons, use the MouseDown and MouseUp events.

See Also

DblClick Event; MouseDown, MouseUp Events.