473,473 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Create 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

TblProjectCounty
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
TblProjectCounty. 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!MyMainForm!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!MyMainForm!StateID.

Thanks for all help!

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

Me!SubFormControlName.Form!ComboBoxName.RowSource = 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.com> wrote:
I have the following tables:
TblState
StateID
State

TblCounty
CountyID
StateID
County

TblProjectState
ProjectStateID
ProjectID
StateID

TblProjectCounty
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
TblProjectCounty. 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!MyMainForm!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!MyMainForm!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.com...
Leave the RowSource of the ComboBox on the SubForm set to "" until the
AfterUpdate event of the ComboBox on the main form. Then:

Me!SubFormControlName.Form!ComboBoxName.RowSource = 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.com> wrote:
I have the following tables:
TblState
StateID
State

TblCounty
CountyID
StateID
County

TblProjectState
ProjectStateID
ProjectID
StateID

TblProjectCounty
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
TblProjectCounty. 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!MyMainForm!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!MyMainForm!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
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
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...
3
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...
0
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
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...
9
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...
11
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...
1
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...
0
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,...
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
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...
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
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,...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.