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

slharman1

Member
Local time
Today, 06:11
Joined
Mar 8, 2021
Messages
476
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?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:11
Joined
Oct 29, 2018
Messages
21,474
The Current event of the main form fires. I'm guessing the Current event of the subform fires too.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:11
Joined
Feb 28, 2001
Messages
27,191
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.
 

561414

Active member
Local time
Today, 06:11
Joined
May 28, 2021
Messages
280
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:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:11
Joined
Feb 19, 2002
Messages
43,293
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

Top Bottom