468,283 Members | 1,936 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,283 developers. It's quick & easy.

How to control form events on subforms?

I have a popup "Tools" form with a tab control that has a different subform
on each tab. The problem is that new tabs/subforms continue to be added as
users request new features - so the code on each subform's
Form_Open/Load/Current event fires whenever the popup form is opened, making
the popup form slow to open and causing problems when a function in one
subform is dependent on data or events in another subform (on a different
tab).

I know the order of events is:

Open ? Load ? Resize ? Activate ? Current

But what I need is more like:

Activate ? Open ? Load ? Current

I could move code from Open and Load to Activate, but that may cause other
issues. And the Current code would still run when the main popup is opened.
Is there a better way to control the events on these subforms? Or should I
just assign existing code to different events?

Thanks in advance.
Nov 13 '05 #1
1 1786
Still testing this...

Set the SourceObject of the subform to "frmBlank", put the working
SourceObject name in the Tag property of the Page that holds the subform,
and use this code on the Change event of the TabControl:

Dim frm As Form
Dim ctl As Control
Dim ctls As Controls
Dim varTab As Variant
Dim strSubFrm As String
Set frm = Me.Form
Set ctls = frm.Controls
Set ctl = ctls("tabTools")
varTab = ctl.Value
strSubFrm = ctl.Pages(varTab).Tag
If ctls(strSubFrm).SourceObject <> strSubFrm Then _
ctls(strSubFrm).SourceObject = strSubFrm

The subform does not open (and no code in the form's module runs) until the
user selects the tab that holds it.
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Weaver | last post: by
7 posts views Thread by Gerry Abbott | last post: by
1 post views Thread by (PeteCresswell) | last post: by
1 post views Thread by veteranwebdesign | last post: by
reply views Thread by NPC403 | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.