Solved What event occurs when user moves to new record on main form and subform updates the list of it's records?

slharman1

Member
Local time
Yesterday, 19:57
Joined
Mar 8, 2021
Messages
483
What event occurs when user moves to new record on main form and subform updates the list of it's records?
In other words:
If move move to another parent record on a form, is there an event that is triggered in either the subform or main form?
 
The Current event of the main form fires. I'm guessing the Current event of the subform fires too.
 
The question also applies as to whether either form was or wasn't dirty, since a dirty form does a behind-the-scenes update, which means there will also be BeforeUpdate and AfterUpdate events. Here is a more detailed explanation.


The detailed description of form/subform event behavior is in the lower portion of the referenced page.
 
When interacting with forms or controls, various events can be triggered based on your actions. These events encompass control events such as Exit, LostFocus, Enter, GotFocus, and Click, among others. Additionally, there are form events like Current, Before/After Update/Insert, and even mouse movements. The specific events that occur depend on your layout and the state of your form.

For example, let's say you had the focus on a main form control, such as a textbox, before entering a subform control. If you then return to the main form by clicking on another control, like a combobox or another textbox, a different set of events will be triggered. Furthermore, the version of Access you're using will also impact which events are fired.

To accurately determine which events are being triggered and their order of execution, it is best to initialize all relevant events and have them print their names. Here's an example:

Private Sub Form_Current()
Debug.Print "Form_Current"
End Sub

It may not be necessary to do this for all events, such as mouse movement events.
 
Last edited:
Hi Steve,
Here is a link to a database that you might find helpful. It logs form and some control level events so you can see what happens. There are two videos that might help to understand how to best use the database. Modify the forms or add your own to see how they work.

 

Users who are viewing this thread

Back
Top Bottom