473,699 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loading Subforms Problem

I have a main form with two subforms. The second subform has a combo
box whose recordsource is set based on a field in the first subform.

I tried putting some code in the first subform to do this. This is the
code in the Form Current section:

strSQL = "SELECT * FROM ModuleComponent s WHERE TrainingModuleT opicSK =
" & subTrainingModu le.Form!Trainin gModuleTopicSK & ";"
submodulecompon ents.Form!cboMo duleComponentTo picsSK.RowSourc e = strSQL

This wasn't working because the subforms load before the main form.
So I went to the main form and for each subform I removed the
Sourceobject. Then I set the sourceobjects for the subforms through
code. This is the code in Form Load:

With Me
..subTrainingMo dule.SourceObje ct = "subTrainingMod ule"
..subModuleComp onents.SourceOb ject = "subModuleCompo nents"
End With

I don't get an error message now but the subforms come up empty. So
now I'm stuck. Does anybody have any ideas where I'm going wrong with
this?

Thanks in advance for the help.

Dec 12 '06 #1
1 1738

Ecohouse wrote:
I have a main form with two subforms. The second subform has a combo
box whose recordsource is set based on a field in the first subform.

I tried putting some code in the first subform to do this. This is the
code in the Form Current section:

strSQL = "SELECT * FROM ModuleComponent s WHERE TrainingModuleT opicSK =
" & subTrainingModu le.Form!Trainin gModuleTopicSK & ";"
submodulecompon ents.Form!cboMo duleComponentTo picsSK.RowSourc e = strSQL

This wasn't working because the subforms load before the main form.
So I went to the main form and for each subform I removed the
Sourceobject. Then I set the sourceobjects for the subforms through
code. This is the code in Form Load:

With Me
.subTrainingMod ule.SourceObjec t = "subTrainingMod ule"
.subModuleCompo nents.SourceObj ect = "subModuleCompo nents"
End With

I don't get an error message now but the subforms come up empty. So
now I'm stuck. Does anybody have any ideas where I'm going wrong with
this?

Thanks in advance for the help.
Here's a way I do dynamic source objects:

NameOfSubformCo ntrol.SourceObj ect = NameOfSumForm

E.g.,

SubformIDO.Sour ceObject = "frmSubIDO"
SubformIDO.Form .RecordSource = "SELECT IDOID, ... FROM tblIDO;"
DoEvents

I believe that simply setting the SourceObject will cause the
recordsource to requery. In cases where the recordsource will be
changing I remove the recordsource from the subform.

When two subforms are involved I use the following:

http://groups.google.com/group/comp....6ad010d?hl=en&

I haven't thought much about the best way to do that.

James A. Fortune
CD********@Fort uneJames.com

Dec 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4003
by: Evil | last post by:
Hi, i have a problem with a treeview and some subforms in MS Access97. I have a form with a treeview on the left side which lets me navigate thru some projects. Then on the right side, i have several Tabs, each with a subform. Now, my tree view nodclick code goes like: sProjNum = me.tvwX.SelectedItem.Key
0
2241
by: Jack | last post by:
Gday everyone, I'm dearly hoping Stephen Lebans is going to update his masterpeice to stop the mouse wheel scrolling to work on subforms *he has indicated this to me but of course beggers can't be choosers here so I have no idea when this would be done*. I'm just wondering if anyone has gotten around the problem some other way? --Original Thread---
12
2006
by: Paul T. RONG | last post by:
Is it possible to divide a tall subform with 80 records to two subforms each with 40 records? Dear All, What I have: Tables: tblProduct, tblOrder, tblOrderDetail
8
3089
by: Zlatko Matić | last post by:
Hello. How can I synchronize subforms content with current record in master form, if both form and subform are based on DAO code ? I assigned DAO recordset to forms by using QueryDef, on Load event. Thanks...
1
1636
by: sasan3 | last post by:
I have a main form "topform" contaning "subform1" and "subform2" The goal is: I need to requery subform2 on CURRENT event of subform1, and I need to load subform2 contents based on settings on subform1. The problem is: Order of loading is: subform1 subform2
4
1929
by: Bill Stock | last post by:
The few times in the past that I've loaded unbound data, I've tended to cheat and use temp tables (not really unbound) or use code for small datasets. I'm currently involved in a project that has numerous tables in the 200 column range, with several thousand rows of data. A consulting review prior to my involvement stressed the wasted space and database speed as the major impetus for normalization. Although the db actually works fairly...
2
2019
by: collegekid | last post by:
Hi everyone, basically my problem is this: I am using an Access 2000 format. And--I have four subforms in my main form. (Purpose of this is to track projects.) So in my main form I enter the project name, one primary point person for it (1:N list from a separate table), other details, and a manually entered tracking number, which is the primary key. Now, I also need to put down the legal entities, business managers, financial...
4
6053
by: Harlequin | last post by:
I have a question concerning the need to trigger events within a "child" subform which is itself enbedded within a master "parent" form and which is accessible via a tab in the parent form. Becuase this is all very difficult to explain in words, please bear with me as I endevour to explain what it is I am trying to do. It would be helpful if I could attach a graphics file to this posting that would help explain what it is I'm trying to achieve...
8
1913
by: Michael R | last post by:
Hi everyone. I have a few subforms in the main form that are dependent on each other with their data (not with child/master fields). Sometimes I get an invalid reference error because the referenced subform isn't loaded (yet). To make them load in the correct order I need to delete them all, then insert them one by one in a correct order. If, later on, I decide to edit one of them of or send it to background, the order breaks and once again...
0
8689
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9035
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8916
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8885
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7752
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2348
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.