Do subforms have a "load" or "made visible" event?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a subform control that I switch between one of several forms based on
the state of the database record. More specifically, the subform shows a
number of editable rows with a different arrangement depending on the number
of items in an order. Changing this is simple enough, setting the
SourceObject string of the subview.

What's not so obvious is WHEN to do this. The subform is in a tab, so it
seems that I should only do it when it becomes visible. Is there some even
that the subform control receives when it becomes visible? OnLoad would be
great, but I don't see it.

Maury
 
The subform should have Enter and Exit events. It also contains load and
open events, but these are only visible when you are actually designing the
form that will become a subfom.

When I use a tab control that contains multiple subforms, I generally only
leave the source object for all the tabs except the first one blank at design
time, then, in the tab controls change event, I check to see what tab the
user has selected (compare the value of the tab control to the page indices
of each of the tabs) and if the source object for the subform on that tab is
still blank, I fill it in.

HTH
 
Subforms are loaded before the main form, so that
doesn't help any (this is why it is a good idea to leave
your subform controls empty until you need them).

If you have them on different tabs, you should be
looking at the tab events.

(david)
 
Dale Fye said:
When I use a tab control that contains multiple subforms, I generally only
leave the source object for all the tabs except the first one blank at design
time, then, in the tab controls change event, I check to see what tab the
user has selected (compare the value of the tab control to the page indices
of each of the tabs) and if the source object for the subform on that tab is
still blank, I fill it in.

Ok, I'll give this a whirl. Thanks!

Maury
 
Back
Top