473,624 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populating a Combo Box with data from a query based on another combo box on same form

119 New Member
I have a form with two combo boxes. The first, cboAccount, allows a user to select an account. Ideally, the second combo box, cboSubAccount, will allow the user to select a Sub Account from a list of Sub Accounts for the particular Account already selected in cboAccount.

In the SubAccount combo box 'Row Source' field I have the following query:

SELECT [Sub Accounts].[Sub Account], [Sub Accounts].Account
FROM [Sub Accounts]
WHERE [Sub Accounts].Account=Forms! frmReportFilter 1!cboAccount
ORDER BY [Account];

When I load up the form, the behaviour works exactly as I want it to for the first Account I select. However, after that, regardless of which Account I select, the list in the SubAccount combo box corresponds to the first account selected, not each subsequent account selected.

Does anyone know how to modify the query so that the cboSubAccount list always relates to the currently selected cboAccount, not always the first cboAccount?

Thanks.
Nov 30 '06 #1
2 1918
billelev
119 New Member
I figured that the problem was that the query was only being executed once, so I hunted around for a way of executing the query for that control based off an event. I implemented the following code:

Private Sub cboAccount_Chan ge()
cboSubAccount.R equery
cboSubAccount.V alue = Null
End Sub


Would be interested to know if anyone has a better solution for what I have been trying to implement, but otherwise I think I'm okay now.
Nov 30 '06 #2
NeoPa
32,566 Recognized Expert Moderator MVP
No - because you've got it dead right.
Dec 1 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
12588
by: sao | last post by:
I am currently using Access 2000. In my table it is the following fields that are set up: 1 - Staff Name 2 - Department This table is already populated with 100+ records (staff along with department.)
1
2031
by: Jason | last post by:
I have a form that is used for entering and editing site address information. The data in the form is from one table, named Total_Site_Address. There are fields in this table (and controls on the form) for entering in a new site address or choosing an existing site address. There are two fields that address the existing site addresses, one named ADDRESS, the other named TAX_NAME (contains municipality info). The ADDRESS field is setup...
2
5446
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would like to eventually be able to filter down through the tables untill i can reach one unique record. I am creating a datbase to keep track of registered accounts for a stae program. Each account is registered into the program through a two...
3
3156
by: ssb | last post by:
Hello, This may be very elementary, but, need help because I am new to access programming. (1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor ?) the values one by one and populate a combo box with these names. (this way, I can display all the EMPLOYEE_NAME values) (2) In general, can I do additional processing on column values from
4
2184
by: Lumpierbritches | last post by:
Thank you once again for any and all assistance. I'm building an application that's getting quite bulky due to the number of forms, macros and procedures. I was wondering if there's a way to use 1 (one) unbound form, if all the fields are the same for multiple forms populating them with Queries? I have a makeshif menu form with command buttons and I would like to eliminate all the forms and replace them with one unbound form for three...
7
2260
by: Megan | last post by:
Hi everybody- I inherited a database that somehow uses a bound combo box as a record selector. Let me give you some background. The form is based on data from 2 tables. The first table, Person, records info about a person. The second table, Case, records information about a person's case, almost like a human resources database. The primary key of the table, person, is his/ her social security number. The primary key of the other...
13
2863
by: melih.onvural | last post by:
Group, I'm having a tough time understanding some of the previous posts on this topic so I wanted to write what I've tried and hope that you can help me troubleshoot. I have a dropdown populated from a table and I want to take that selection and use it to populate the next dropdown. So far: 1) I tried using a query that said select specificissue from specific_issue and used as my criterion !!
11
2793
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field (strPubCity) for Publisher City. These two fields have a many-to-one relationship with tables, (tlkpPubName and tlkpPubCity) respectively. The lookup tables only have one field (strPubName and strPubCity), which is their primary key. I also have...
3
3562
by: davenumber40 | last post by:
I’m creating a small database in Access 2003(XP) to track issues during software testing. As far as databases go, it’s going to be a relatively small, short term project (No more than 20,000 records in the main table over about 2 months). I have a main table (Issues) that is populated by a form (IssueAdds). On my form there is a combobox to select Opened by (who created the record). That list is populated by a table called Contacts. Here...
0
8231
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
8672
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
8614
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
8330
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
7153
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
6107
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
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1474
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.