Events occur for controls on forms when you move the focus to a control, and when you change and update data in a control.
When you move the focus to a control on a form — for example, by opening a form that has one or more active controls or by moving to another control on the same form — the Enter and GotFocus events occur in this order:
Enter Þ GotFocus
If you are opening a form, these events occur after the events associated with opening the form (such as Open, Activate, and Current), as follows:
Open (form) Þ Activate (form) Þ Current (form) Þ Enter (control) Þ GotFocus (control)
When the focus leaves a control on a form — for example, when you close a form that has one or more active controls or move to another control on the same form — the Exit and LostFocus events occur in this order:
Exit Þ LostFocus
If you are closing a form, the Exit and LostFocus events occur before the events associated with closing the form (such as Unload, Deactivate, and Close), as follows:
Exit (control) Þ LostFocus (control) Þ Unload (form) Þ Deactivate (form) Þ Close (form)
When you enter or change data in a control on a form and then move the focus to another control, the BeforeUpdate and AfterUpdate events occur:
BeforeUpdate Þ AfterUpdate
The Exit and LostFocus events for the changed control occur after the BeforeUpdate and AfterUpdate events:
BeforeUpdate Þ AfterUpdate Þ Exit Þ LostFocus
When you change the text in a text box or in the text box portion of a combo box, the Change event occurs. This event occurs whenever the contents of the control change, but before you move to a different control or record (and thus, before the BeforeUpdate and AfterUpdate events occur). The following sequence of events occurs for each key you press in a text box or in the text box portion of a combo box:
KeyDown Þ KeyPress Þ Change Þ KeyUp
The NotInList event occurs after you enter a value in a combo box that isn't in the combo box list and then attempt to move to another control or record. It occurs after the keyboard events and the Change events for the combo box, but before any other control or form events. If the LimitToList property of the combo box is set to Yes, the Error event for the form occurs immediately after the NotInList event:
KeyDown Þ KeyPress Þ Change Þ KeyUp Þ NotInList Þ Error
For more information on events, click .