473,796 Members | 2,911 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 3448
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
1983
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
2296
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
4505
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
1369
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
1898
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
9713
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
4165
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
2475
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
1159
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
9685
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
9535
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
10244
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
10201
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
10021
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
9061
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...
1
7558
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
5454
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2931
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.