472,807 Members | 1,660 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,807 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

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 2295
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

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...
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...
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...
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......
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...
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...
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...
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...
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...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: lllomh | last post by:
How does React native implement an English player?
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.