473,403 Members | 2,222 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,403 software developers and data experts.

Populate List Box via two Combo Box

hi guys and girls,

What i have is a list of account codes, and a list of cost centres. Each combination of these (so for example "5030" and "Externals") will have it's own budget reference sperate form another (so 5030 externals would have a different budget from 5030 software etc)

i have a form ("Form1") that has two combo boxes ("Cost" and "Account") that i would like to use to populate the list box ("Ref"). The table is "BudgetRef" I have the query currently set at:-
Expand|Select|Wrap|Line Numbers
  1. SELECT BudgetRef.Budget_Reference, BudgetRef.Account_Name, BudgetRef.Cost_Center
  2. FROM BudgetRef
  3. WHERE BudgetRef.Cost_Center=Forms!Form1!Cost
so that the "Cost" combo correctly populates the "Ref" list box. how would i go about adding the 2nd combo ("account") to the query? i've Tried to add AND in the WHERE but it returns a blank list box.

Oh and i've added the .requery on the combo changes so i dont think t is that.

Any help would be great

Thanks
Oct 30 '09 #1
2 2234
ChipR
1,287 Expert 1GB
You should be able to add to the Where clause, but assuming Account is a text field, it needs to be in quotes. Maybe something like:
Expand|Select|Wrap|Line Numbers
  1. "SELECT BudgetRef.Budget_Reference, BudgetRef.Account_Name, BudgetRef.Cost_Center
  2. FROM BudgetRef
  3. WHERE BudgetRef.Cost_Center = " & Forms!Form1!Cost
  4. & " AND Account = """ & Forms!Form1!Account & """"
Oct 30 '09 #2
NeoPa
32,556 Expert Mod 16PB
Assuming the Account_Name field is the one that holds the data to match your Account ComboBox then :
Expand|Select|Wrap|Line Numbers
  1. SELECT Budget_Reference,
  2.        Account_Name,
  3.        Cost_Center
  4. FROM   BudgetRef
  5. WHERE  Cost_Center=Forms!Form1!Cost
  6.   AND  Account_Name=Forms!Form1!Account
Oct 31 '09 #3

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

Similar topics

0
by: Joyce | last post by:
The XML Schema design problem to solve is as follows: We have 2 combo boxes to populate from schema data, let's say: 1. States 2. Cities (and this one gets populated depending on the choice of...
1
by: Cindi | last post by:
Hi, Another newbie with a question that I hope someone can point me in the right direction. The goal is to populate a text box with data according to the selection in a combo box while still...
11
by: DSR | last post by:
Help Please... I would like to populate a combo box on a form with a query that compares data from two tables. Any record that is unique in table1 should continue to populate my combobox. The...
5
by: KCProg | last post by:
I created a form with a subform. I can populate the subform by moving from record to record in the main form but this is time consuming. I created a combo box on the main form which is populated...
5
FOE2272
by: FOE2272 | last post by:
I have tried every option that I can think of and most of them on this forum. The closest that I got was to bring up the field but it changed the other records based on what was chosen in one...
2
by: Jacko7289 | last post by:
Good Day, My form has two combo boxes where the list of second combo box is dependent on the data chosen from the first combo box. This is how the table (source of data) looks like... Table 1:...
18
by: jmarcrum | last post by:
Hi everyone! I have a form that when the user opens it, the Date combo box on the form is populated with every month of the year. But I don't want it to do that! I want it to populate with the...
5
by: giandeo | last post by:
Hello Experts. Could you find a solution for this problem please! I have the following tables in Access Database Table Name: origin Fields Names: country, countrycode Table Name: make...
5
by: Kaosman | last post by:
I have been trying to figure out this problem for a while. All I want to do is have a combo box populate a list box and the list box change to the record based on the users choice. The combo...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
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,...
0
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...

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.