473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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 2349
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John Hunter | last post by:
I've recently had a nasty problem with the "Invalid reference to the property Form" error in subforms - nasty because it doesn't seem to consistently happen to all forms which contain the same...
5
by: Weaver | last post by:
I'm new to Access. But I've been ooping for about twelve or thirteen years in another language. I've got a form with two instances of the same sub-form. It works quite well, or at least it...
7
by: Gerry Abbott | last post by:
Hi all, Ive got a form with several controls which contain date fields. I'm usng the activex calender control as a separate floating form, I would like to be able to click onto any of the date...
3
by: Not Me | last post by:
Hi, Just trying to get my head around tab controls, is there anywhere which would describe the structure of how they work? I seem to be ok so far, being able to check which page I'm on etc......
2
by: jodyblau | last post by:
I am trying use a Calendar Control 10.0 in one of my forms. (I am using access 2002) What I want to do is have the user click a button which makes the calendar visible. Then when the user...
2
by: robert.waters | last post by:
Hello, If I have a form containing a Tab Control with N pages, each page containing a subform, are those subforms loaded into memory when another page has the focus? I have tried iterating...
7
by: ApexData | last post by:
I am using the following code in my TabControl to manage subform loads. The code assigns the subForms SourceObject. - Do I also need code to DeAssign the SourceObject when leaving the Tab, I'm...
1
by: (PeteCresswell) | last post by:
Posted this on microsoft.public.access a few days ago, but no nibbles. ---------------------------------------------------------------------------------------------------- I've got a form with a...
1
by: veteranwebdesign | last post by:
Hello, I have a main form. I want forms to open in a subform control box. What is the code for the option group to open the subforms in the control box. I didn't create subforms, I created...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.