Form Events (Access)

GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

This object has the following events:

Name

Description

Activate

The Activate event occurs when a form receives the focus and becomes the active window.

AfterDelConfirm

The AfterDelConfirm event occurs after the user confirms the deletions and the records are actually deleted or when the deletions are canceled.

AfterFinalRender

Occurs after all elements in the specified PivotChart view have been rendered.

AfterInsert

The AfterInsert event occurs after a new record is added.

AfterLayout

Occurs after all charts in the specfied PivotChart view have been laid out, but before they have been rendered.

AfterRender

Occurs after the object represented by the chartObject argument has been rendered.

AfterUpdate

The AfterUpdate event occurs after changed data in a control or record is updated.

ApplyFilter

Occurs when a filter is applied to a form.

BeforeDelConfirm

The BeforeDelConfirm event occurs after the user deletes to the buffer one or more records, but before Microsoft Access displays a dialog box asking the user to confirm the deletions.

BeforeInsert

The BeforeInsert event occurs when the user types the first character in a new record, but before the record is actually created.

BeforeQuery

Occurs when the specified PivotTable view queries its data source.

BeforeRender

Occurs before any object in the specified PivotChart view has been rendered.

BeforeScreenTip

Occurs before a ScreenTip is displayed for an element in a PivotChart view or PivotTable view.

BeforeUpdate

The BeforeUpdate event occurs before changed data in a control or record is updated.

Click

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

Close

The Close event occurs when a form is closed and removed from the screen.

CommandBeforeExecute

Occurs before a specified command is executed. Use this event when you want to impose certain restrictions before a particular command is executed.

CommandChecked

Occurs when the specified Microsoft Office Web Component determines whether the specified command is checked.

CommandEnabled

Occurs when the specified Microsoft Office Web Component determines whether the specified command is enabled.

CommandExecute

Occurs after the specified command is executed. Use this event when you want to execute a set of commands after a particular command is executed.

Current

Occurs when the focus moves to a record, making it the current record, or when the form is refreshed or requeried.

DataChange

Occurs when certain properties are changed or when certain methods are executed in the specified PivotTable view.

DataSetChange

Occurs whenever the specified PivotTable view is data-bound and the data set changes — for example, when a filter operation takes place. This event also occurs when initial data is available from the data source.

DblClick

The DblClick event occurs when the user presses and releases the left mouse button twice over an object within the double-click time limit of the system.

Deactivate

The Deactivate event occurs when a form loses the focus to a Table, Query, Form, Report, Macro, or Module window, or to the Database window.

Delete

Occurs when the user performs some action, such as pressing the DEL key, to delete a record, but before the record is actually deleted.

Dirty

The Dirty event occurs when the contents of the specified control changes.

Error

The Error event occurs when a run-time error is produced in Microsoft Access when a form has the focus.

Filter

Occurs when the user opens a filter window by clicking Filter by Form, Advanced Filter/Sort, or Server Filter By Form.

GotFocus

The GotFocus event occurs when the specified object receives the focus.

KeyDown

The KeyDown event occurs when the user presses a key while a form or control has the focus. This event also occurs if you send a keystroke to a form or control by using the SendKeys action in a macro or the SendKeys statement in Visual Basic.

KeyPress

The KeyPress event occurs when the user presses and releases a key or key combination that corresponds to an ANSI code while a form or control has the focus. This event also occurs if you send an ANSI keystroke to a form or control by using the SendKeys action in a macro or the SendKeys statement in Visual Basic.

KeyUp

The KeyUp event occurs when the user releases a key while a form or control has the focus. This event also occurs if you send a keystroke to a form or control by using the SendKeys action in a macro or the SendKeys statement in Visual Basic.

Load

Occurs when a form is opened and its records are displayed.

LostFocus

The LostFocus event occurs when the specified object loses the focus.

MouseDown

The MouseDown event occurs when the user presses a mouse button.

MouseMove

The MouseMove event occurs when the user moves the mouse.

MouseUp

The MouseUp event occurs when the user releases a mouse button.

MouseWheel

Occurs when the user rolls the mouse wheel in Form View, Split Form View, Datasheet View, Layout View, PivotChart View, or PivotTable View.

OnConnect

Occurs when the specified PivotTable view connects to a data source.

OnDisconnect

Occurs when the specified PivotTable view disconnects from a data source.

Open

The Open event occurs when a form is opened, but before the first record is displayed.

PivotTableChange

Occurs whenever the specified PivotTable view field, field set, or total is added or deleted.

Query

Occurs whenever the specified PivotTable view query becomes necessary. The query may not occur immediately; it may be delayed until the new data is displayed.

Resize

The Resize event occurs when a form is opened and whenever the size of a form changes.

SelectionChange

Occurs whenever the user makes a new selection in a PivotChart view or PivotTable view.

Timer

The Timer event occurs for a form at regular intervals as specified by the form's TimerInterval property.

Undo

Occurs when the user undoes a change.

Unload

The Unload event occurs after a form is closed but before it's removed from the screen. When the form is reloaded, Microsoft Access redisplays the form and reinitializes the contents of all its controls.

ViewChange

Occurs whenever the specified PivotChart view or PivotTable view is redrawn.

Show: