473,848 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Criteria For Subform Combobox Rowsource

Tom
I have the following tables:
TblState
StateID
State

TblCounty
CountyID
StateID
County

TblProjectState
ProjectStateID
ProjectID
StateID

TblProjectCount y
ProjectCountyID
ProjectStateID
CountyID

A project may be in multiple states and multiple counties in a state. I have
a main form based on TblProjectState and a subform based on
TblProjectCount y. There is a combobox in the main form with a row source of
TblState for entering StateID. How can I set up the rowsource for the
combobox in the subform for selecting counties? That combobox should only
list the counties in the State selected in the main form. I tried using a
query based on TblCounty and setting the criteria to
Forms!MyMainFor m!StateID but the subform loads before the main form and
consequently StateID in the main form is not available to the criteria in
the query and a parameter dialog box comes up asking for
Forms!MyMainFor m!StateID.

Thanks for all help!

Tom
Nov 13 '05 #1
2 3454
Leave the RowSource of the ComboBox on the SubForm set to "" until the
AfterUpdate event of the ComboBox on the main form. Then:

Me!SubFormContr olName.Form!Com boBoxName.RowSo urce = YourQuery (or
"Your SQL")

Replacing my dummy names with your real names of the SubFormControl
and the ConboBox.

On Mon, 22 Aug 2005 17:48:16 GMT, "Tom" <no***@email.co m> wrote:
I have the following tables:
TblState
StateID
State

TblCounty
CountyID
StateID
County

TblProjectStat e
ProjectState ID
ProjectID
StateID

TblProjectCoun ty
ProjectCountyI D
ProjectState ID
CountyID

A project may be in multiple states and multiple counties in a state. I have
a main form based on TblProjectState and a subform based on
TblProjectCoun ty. There is a combobox in the main form with a row source of
TblState for entering StateID. How can I set up the rowsource for the
combobox in the subform for selecting counties? That combobox should only
list the counties in the State selected in the main form. I tried using a
query based on TblCounty and setting the criteria to
Forms!MyMainFo rm!StateID but the subform loads before the main form and
consequently StateID in the main form is not available to the criteria in
the query and a parameter dialog box comes up asking for
Forms!MyMainFo rm!StateID.

Thanks for all help!

Tom


_______________ _______________ _______________ __
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
Nov 13 '05 #2
Tom
How will the combobox display any records previously entered when the form
opens if the combobox has no Row Source when the form opens?
<RuralGuy> wrote in message
news:p2******** *************** *********@4ax.c om...
Leave the RowSource of the ComboBox on the SubForm set to "" until the
AfterUpdate event of the ComboBox on the main form. Then:

Me!SubFormContr olName.Form!Com boBoxName.RowSo urce = YourQuery (or
"Your SQL")

Replacing my dummy names with your real names of the SubFormControl
and the ConboBox.

On Mon, 22 Aug 2005 17:48:16 GMT, "Tom" <no***@email.co m> wrote:
I have the following tables:
TblState
StateID
State

TblCounty
CountyID
StateID
County

TblProjectSta te
ProjectStateI D
ProjectID
StateID

TblProjectCou nty
ProjectCounty ID
ProjectStateI D
CountyID

A project may be in multiple states and multiple counties in a state. I
have
a main form based on TblProjectState and a subform based on
TblProjectCou nty. There is a combobox in the main form with a row source
of
TblState for entering StateID. How can I set up the rowsource for the
combobox in the subform for selecting counties? That combobox should only
list the counties in the State selected in the main form. I tried using a
query based on TblCounty and setting the criteria to
Forms!MyMainF orm!StateID but the subform loads before the main form and
consequentl y StateID in the main form is not available to the criteria in
the query and a parameter dialog box comes up asking for
Forms!MyMainF orm!StateID.

Thanks for all help!

Tom


_______________ _______________ _______________ __
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.

Nov 13 '05 #3

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

Similar topics

1
1988
by: Filips Benoit | last post by:
Dear All, W2000 Office2000 Access adp SQLserver DB Problem: Adding a new property for a company in the subform. The FIRST time I Select a property in combobox CPROP_PRP_ID the subform act
4
2298
by: CSDunn | last post by:
Hello, I have a combo box (Combo7) that needs to call a function during the After Update event of the combo box. The function resides in an Access 2000 ADP Module called MMAnswerData_code. The following is the code of the function: Public Function SubFormRS(FrmTarget As Object) Forms!frmAD_OpeningForm!FrmTarget.RecordSource = "EXEC dbo.AdSubFormRecSource " & Forms!frmAD_OpeningForm!SubFormFilter
3
4511
by: Nicolae Fieraru | last post by:
Hi All, I have a problem and I can't figure out how to solve it. My database has three tables: tblCustomers, with CustomerId and CustomerName tblProducts, with ProductId and ProductCode tblPurchases, with PurchaseId, CustomerId and ProductId I created a form with a subform which shows all the customers, one at a time
0
1372
by: Filips Benoit | last post by:
Dear All, W2000 Office2000 Access adp SQLserver DB Problem: Adding a new property for a company in the subform. The FIRST time I Select a property in combobox CPROP_PRP_ID the subform act
1
1903
by: Mariel | last post by:
Hello, I hava a main form F1, form with a subform F2 in datasheet view. There is a combobox in the main form C1, and a combobox C2 in the subform. I want the dropdown options of the combobox in C2 to change depending on the value selected in C1. I've tried to specify the datasurce for the C2 values as:
9
9721
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
11
4170
by: svdoerga | last post by:
Hello! I have a question I've been working on for a few days now and I can't find a solution. I hope there is someone that has the answer :) I'm using Access 2003 in win XP. I have a main form called "MulitLineView", that has a subform called "subLinelistView". In the main form's "Form_Open" event I use a query to open the contents of a table for editing in the subform in datasheet mode like this: Set qdf = db.CreateQueryDef(strQueryName,...
1
2478
by: Rosie | last post by:
I have a main form with header info w/ 'tHeader' as the control source. I have a subform with 'tDetail' as a control source. They're strung together by a field named MA_ID. This works fine. I have a field within the subform that I want to update via a combobox located on the same subform.
0
1162
by: fenners | last post by:
Hi new to programming VBA in Access 2003. I have a form which has two comboboxes. The first combobox uses the folowing rowsource. SELECT Outputs_Classification.Output_id, Outputs_Classification.OutputClass FROM Outputs_Classification; The second combobox uses the afterupdate VBA code to select the rowsource of the second combbobox as below.
0
9735
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10997
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10661
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...
0
10347
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...
1
7889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5917
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4542
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4134
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3172
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.