473,378 Members | 1,478 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,378 software developers and data experts.

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 ModuleComponents WHERE TrainingModuleTopicSK =
" & subTrainingModule.Form!TrainingModuleTopicSK & ";"
submodulecomponents.Form!cboModuleComponentTopicsS K.RowSource = 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
..subTrainingModule.SourceObject = "subTrainingModule"
..subModuleComponents.SourceObject = "subModuleComponents"
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 1726

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 ModuleComponents WHERE TrainingModuleTopicSK =
" & subTrainingModule.Form!TrainingModuleTopicSK & ";"
submodulecomponents.Form!cboModuleComponentTopicsS K.RowSource = 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
.subTrainingModule.SourceObject = "subTrainingModule"
.subModuleComponents.SourceObject = "subModuleComponents"
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:

NameOfSubformControl.SourceObject = NameOfSumForm

E.g.,

SubformIDO.SourceObject = "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********@FortuneJames.com

Dec 14 '06 #2

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

Similar topics

3
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...
0
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...
12
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
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...
1
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...
4
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...
2
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...
4
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...
8
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.