Events occur for records on forms when you move the focus to a record, update data in a record, delete an existing record or records, or create a new record.
When you move the focus to an existing record on a form, enter or change data in the record, and then move the focus to another record, the following sequence of events occurs for the form:
Current (form) Þ BeforeUpdate (form) Þ AfterUpdate (form) Þ Current (form)
When you leave the record whose data has changed, but before you enter the next record, the Exit and LostFocus events occur for the control with the focus. These events occur after the BeforeUpdate and AfterUpdate events for the form, as follows:
BeforeUpdate (form) Þ AfterUpdate (form) Þ Exit (control) Þ LostFocus (control) Þ Current (form)
As you move the focus among the controls on a form, events occur for each control. For example, the following sequences of events occur when you:
Current (form) Þ Enter (control) Þ GotFocus (control) Þ BeforeUpdate (control) Þ AfterUpdate (control)
Exit (control1) Þ LostFocus (control1) Þ Enter (control2) Þ GotFocus (control2)
BeforeUpdate (form) Þ AfterUpdate (form) Þ Exit (control2) Þ LostFocus (control2) Þ Current (form)
For more information on the order of events for controls on forms, click .
When you delete a record, the following events occur for the form, and Microsoft Access displays a dialog box asking you to confirm the deletion:
Delete Þ BeforeDelConfirm Þ AfterDelConfirm
If you cancel the Delete event, the BeforeDelConfirm and AfterDelConfirm events don't occur and the dialog box isn't displayed.
When you move the focus to a new (blank) record on a form and then create a new record by typing in a control, the following sequence of events occurs:
Current (form) Þ Enter (control) Þ GotFocus (control) Þ BeforeInsert (form) Þ AfterInsert (form)
The BeforeUpdate and AfterUpdate events for the controls on the form and for the new record occur after the BeforeInsert event and before the AfterInsert event.
For more information on events, click .