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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control load order of form/subform

Status
Not open for further replies.

egstatus

Programmer
Apr 14, 2005
143
0
0
US
Hi Everyone,
Is there a way I can control how forms/sub-forms load?

It seems like the order is not the same every time the application runs and for my application the order is important.

I have an MainForm(GrandParent) that have 5 Sub-forms(Parents). Each of the Sub-forms(Parents) within the MainForm(GrandParent) have Sub-forms(Children).
I want to always load the MainForm(GrandParent) first, then the the Sub-forms(Parents) and finally the Sub-forms(Children).

How can I control the load order?

Thanks

Ed
 
Forms load from inside out no way to control that. But as Duane said you can have a subform control on the main form with no source object. Then set the source object in the on load event. You probably will have to set any linking parent child properties as well. Then do the same on the subform.

But why would you have to change the order? The only thing I can think of is that the children reference the parent form. My guess would be in the current event of the child. This should be a trappable error to see if the parent is loaded.
 
Hey MajP/Duane,


That is exactly it. I'm referencing fields that are on the parent form, but if the child loads first then it errors out. I can trap the error and if at that point I set the source object of the parent form to whatever should be, the code continues to run however the result is a blank form, with not a single control. [Not what I want]

I will try what Duane(dhookom) sugested.

Thanks

Ed
 
Can you post your code where it errors out?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top