Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access Forms: Event Processing Order

Status
Not open for further replies.

HardingR2000

Programmer
Oct 6, 2008
40
US
I have a form containing two subforms. The form is TrsumGroup_Modify_Frm and the subforms are TrsumGroup_ModifySet_SubFrm and TrsumGroup_LCList_SubFrm.

When I start (open) the main form (TrsumGroup_Modify_Frm) the following events occur in the order listed below.

TrsumGroup_ModifySet_SubFrm: Form_Open()
TrsumGroup_ModifySet_SubFrm: Form_Load()
TrsumGroup_Modify_Frm: Form_Activate()
TrsumGroup_Modify_Frm: Form_GotFocus()
TrsumGroup_Modify_Frm: Form_Resize()
TrsumGroup_ModifySet_SubFrm: Form_Current()
TrsumGroup_Modify_Frm: Form_LostFocus()
TrsumGroup_Modify_Frm: Form_Current()
TrsumGroup_ModifySet_SubFrm: Form_Resize()
TrsumGroup_ModifySet_SubFrm: Form_Current()
TrsumGroup_LCList_SubFrm: Form_Open()
TrsumGroup_LCList_SubFrm: Form_Load()
TrsumGroup_LCList_SubFrm: Form_Current()
TrsumGroup_LCList_SubFrm: Form_Resize()
TrsumGroup_LCList_SubFrm: Form_Current()
TrsumGroup_Modify_Frm: Form_Open()


As you can see above, the Open event for the main form (TrsumGroup_Modify_Frm) is not the first event processed. The order processed is not the order listed in official MS documentation (Open -> Load -> Resize -> Activate -> Current).

When I close the main form the following events occur in the order listed below.

TrsumGroup_Modify_Frm: Form_Load()
TrsumGroup_Modify_Frm: Form_Resize()
TrsumGroup_Modify_Frm: Form_Unload()
TrsumGroup_Modify_Frm: Form_Deactivate()
TrsumGroup_Modify_Frm: Form_Close()
TrsumGroup_Modify_Frm: Form_Resize()
TrsumGroup_LCList_SubFrm: Form_Current()
TrsumGroup_LCList_SubFrm: Form_Current()
TrsumGroup_LCList_SubFrm: Form_Unload()
TrsumGroup_LCList_SubFrm: Form_Close()
TrsumGroup_ModifySet_SubFrm: Form_Close()

As you can see in both sets of events there is a strange order to the events being processed, particularly as it applies to the main form.

Is there any documentation that might explain the event processing order where form and subforms exist?
 
How are ya HardingR2000 . . .
HardingR2000 said:
[blue]Is there any documentation that might explain the event processing order where form and subforms exist?[/blue]
There's a small amout here and there but it all relates to a single form. However you've stumbled unpon something to be aware of:
TheAceMan said:
[blue]For a form with subforms, the form opens from the deepest level subform out to the mainform which opens last.

If a subform requires data from the mainform on open, you can see the problem ... the mainform isn't open yet![/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
AceMan1,
Thanks for the reply.

I guess the best thing to do to understand the event order for specific form/subform combinations is to use the debug.print facility, as I did, to trace the order of processing.

It is still curous as to why certain events happen in the order shown. Maybe someone else out there in AccessLand can provide additional information.

HardingR2000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top