By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,287 Members | 1,545 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,287 IT Pros & Developers. It's quick & easy.

How to control form events on subforms?

P: n/a
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

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
Share this Question
Share on Google+
1 Reply

P: n/a
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.