UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> Access 97 Form Events And When They Occur    
Access 97 Form Events And When They Occur

Forms

EVENT PROPERTIES
On Current Occurs when a form is first opened, whenever focus leaves one record and goes to another, or when the form is required.
Before Insert Occurs when the user types the first character into a new record, but before the record is actually created.
After Insert Occurs after a new record is added.
On 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.
Before Delete Confirm Occurs after the user deletes on or more records, but before Access displays a dialog box asking the user to confirm the deletions.
After Delete Confirm Occurs after the user confirms the deletions and the records are actually deleted or when the deletions are cancelled.
On Open For forms, occurs when a form is opened but before the first record is displayed. For reports, the event occurs before a report is previewed or printed.
On Close Occurs when a form or report is closed and removed from the screen.
On Load Occurs when a form is opened and records displayed. The Load event occurs before Current and after Open.

Related events: Activate, GotFocus

On Unload Occurs when the form is closed but before it is removed from the screen.
On Activate Occurs when the form or report receives the focus and becomes the active window. Occurs before the GotFocus event. The form must be visible.
On Deactivate Occurs when the form loses focus, as long as the form that receives the focus is not a dialog, has the PopUp property set to Yes, or is in another application. Occurs after the LostFocus event.
On Resize Occurs whenever a form is opened or the size of the form changes.
On GotFocus Occurs whenever a control or form receives the focus. You may invoke the SetFocus method to give a form or object the focus. A control must have both the Visible and the Enabled properties set to Yes to receive focus. A form can receive focus only if all the controls are disabled or no controls exist. Occurs after the Enter event.
On LostFocus Occurs whenever a control or form loses the focus. Occurs after the Exit event.
On Click Occurs when the user clicks a disabled control or a blank portion of a form.
On DblClick Occurs when the user clicks and releases the left mouse button twice in quick succession. For forms, DblClick occurs only on a disabled control or a blank area of the form. If the second click does not occur within the double-click time limit for the system, the form recognizes two Click events rather than the double-click. The double-click time limit depends upon the setting of Double Click Speed in the mouse section of the Windows Control Panel.
On MouseDown Occurs when the user presses a mouse button down. You can use the event to evaluate which of the mouse buttons the user has depressed. The object that receives the first mouse press will process all mouse key presses until the last MouseUp event is processed.
On MouseUp Occurs when the user releases a mouse button.
On MouseMove Occurs when the user moves the mouse over the object. MouseMove events can be triggered if the user moves the form under the mouse pointer.
On KeyPress Occurs when the user presses and releases a key or key combination that corresponds to an ANSI keycode. The form must have no controls or only disabled controls for it to receive a KeyPress event. KeyPress recognizes any standard printable keyboard character, a Ctl key and a standard character, and the Enter and Backspace keys.
On KeyDown Occurs when a key is presses. See also on KeyUp
On KeyUp Occurs when a key is released. Occurs only on forms that have no controls or whose controls are disabled.
On Error Occurs when a runtime error is generated within Access. The errors include Microsoft Jet engine errors but not Access Basic runtime errors.
On Timer Occurs at regular intervals as specified by the form’s Timer Interval property.
Timer Interval Specifies the interval between Timer events in milliseconds.


Controls

CONTROL PROPERTIES
AfterUpdate Occurs after changed data in a control or record is updated.
BeforeUpdate Occurs before changed data in a control or record is updated. For forms, you can use the BeforeUpdate event to cancel updating of a record before moving to another record. You often use the BeforeUpdate event to validate data, especially when you perform complex validations, such as those that
  • Involve conditions for more than one value on a form.
  • Display different error messages for different data entered.
  • The user can override.
  • Contain references to controls on other forms or contain user-defined functions.
On Change Occurs when the contents of a text box or the text portion of a combo box changes. This action includes entering a character directly in the text box or combo box or changing the control’s Text property setting using a macro or Access Basic.
  • Tip - By running a macro or executing an event procedure when a Change event occurs, you can coordinate data display among controls. You also can display data or a formula in one control and the results in another control.
  • Note - A Change event can cause a cascading event. This event occurs when a macro or event procedure that runs in response to the control’s Change even alters the control’s contents (for example, by changing a property setting that determines the control’s value, such as the Text property for a text box). To prevent a cascading event, avoid attaching a Change macro or event procedure to a control that alters the control’s contents. Avoid creating two or more controls whose Change events affect each other (for example, two text boxes that update each other).
On Click Occurs when the user clicks the mouse. The Click event also can be triggered by the following actions:
  • Changing the setting of the Value property.
  • Pressing a control’s access key.
  • Pressing Esc when a command button’s Cancel property is set to Yes.
  • Pressing Enter when a command button’s Default property is set to Yes.
  • Pressing the space bar on a command button, list box, or check box that has the focus.

Related Events for a list box: MouseDown, MouseUp, Click.

On DblClick Occurs when the user clicks the left mouse button twice in quick succession. If the double-click does not occur within the double-click time limit for the system, two Click events are processed. For command buttons, double-clicking triggers events in this order: Click, Double-Click, Click. To cancel the second click event, use the CancelEvent action in the DblClick event code or macro.
On Enter Occurs before a control actually receives the focus from a control on the same form. The Enter event occurs before GotFocus and unlike GotFocus, is not triggered when the user leaves the current control to move to another form and then moves back to the current control.
On Exit Occurs after a control loses focus to another control on the same form. Exit occurs before LostFocus and only occurs when focus is lost to a control on the same form.
On GotFocus Occurs when a control receives the focus. Unlike Enter, the focus may come from somewhere on the same form or from a different form. For the GotFocus event to be triggered, a control must have both the Enabled and Visible properties set to Yes. Occurs after the Enter event.
On LostFocus Occurs when a control loses focus. Unlike Exit, the focus may be lost to the same or different form. Occurs after the Exit event.
On KeyDown Occurs when a key is pressed. See also On KeyUp
On KeyPress Occurs when the user presses and releases a key or key combination that corresponds to an ANSI keycode. KeyPress recognizes any standard printable keyboard character, a Ctl key and a standard character, and the Enter and Backspace keys.
On KeyUp Occurs when a key is released. Typically used to distinguish between the following keys: extended key characters (function keys), navigation keys (arrows, page, etc.), combinations of keys and key modifiers (Shift, Alt, etc.), numeric keypad, and keyboard numbers. KeyUp and KeyDown events are not fired if Esc is pressed and a command button’s Cancel is Yes, or Enter is pressed and a command button’s Default is Yes.
On MouseDown Occurs when the user presses a mouse button. You can use the event to evaluate which of the mouse buttons the user has depressed along with the location. The object that receives the first mouse press will process all mouse key presses until the last MouseUp event is processed.
On MouseMove Occurs when the user moves the mouse over the object.
On MouseUp Occurs when the user releases a mouse button.
On NotInList Occurs when the user enters a value in the text box portion of a combo box that isn’t in the combo box list. This event enables the user to add a new value to the combo box list.
  • Note - The NotInList event doesn’t trigger the Error event. The LimitToList property must be set to Yes for the NotInList event to occur.
On Updated Occurs when on OLE object’s data has been modified.
Edit Discussion
Custom Search
Thank you for your support!
This page has been accessed 9,658 times.  This page was last modified 11:34, 14 February 2012 by Jack Leach. Contributions by Alan Greenwood  Disclaimers