473,804 Members | 3,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to populate list of Combo box 2 after selecting from a list from combo box 1

10 New Member
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: PROD
Prod (PK)
Prod_Desc

Table 2: PROD_CAT
Prod (FK)
Prod_Cat
Prod_Cat_Desc

....the tables has one to many relationship...
Anyway, The first combo box fetches the list(Prod) from PROD table directly. And what i want to happen is that after choosing from it, the second combo box should then list all the Prod_Cat under the selected Prod only.
Hope i make myself clear but in any case, any help will be greatly appreciated.
Jul 15 '07 #1
2 1883
Lysander
344 Recognized Expert Contributor
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: PROD
Prod (PK)
Prod_Desc

Table 2: PROD_CAT
Prod (FK)
Prod_Cat
Prod_Cat_Desc

....the tables has one to many relationship...
Anyway, The first combo box fetches the list(Prod) from PROD table directly. And what i want to happen is that after choosing from it, the second combo box should then list all the Prod_Cat under the selected Prod only.
Hope i make myself clear but in any case, any help will be greatly appreciated.
In the after_update event of combo box1, you can set the rowsource of combo box 2. Something like this
Expand|Select|Wrap|Line Numbers
  1. cboBox2.rowsource="Select Prod_cat from [table 2] where prod=" & cboBox1 & ";"
  2.  
if prod is text and not a number, then use & chr(34) & cboBox1 & chr(34) &
Jul 15 '07 #2
NeoPa
32,579 Recognized Expert Moderator MVP
Hi Jacko.

There is an article (Example Filtering on a Form.) that takes you through all this.
Jul 15 '07 #3

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

Similar topics

0
1676
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 the state) The event management is no problem, the question is, how do we build our XML Schema (that's going to contain the data for both states and
2
10632
by: Brian | last post by:
Hope you all had a great holiday. I have a subform with a table with a combo box based on a select query. The combo box is set to display in a form in datasheet view. When I click the down arrow I can see all of the columns in the combo box but it only shows one column after selecting it. I would like all of the columns to display when an item in the list is selected. Is this possible?
1
2040
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 being able to navigate the records one by one. The combo box record source is a table/query asking for the ID, Subj, Title, CourseGoals from one table and displays Column 1. I've set up the text box
11
12313
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 instant the record appears also in table2 it should no longer be listed in my combo box. This is not a key field in either of the tables. Basically what I am trying to do is prevent the user from entering duplicate values even though it is not a key...
1
2819
by: bbcdancer | last post by:
Is it possible to restrict the length of a text box in MS Access using VBA on condition to what is selected in a list combo box. Scenario: 1. I have a list combo box containing: AA BBB CCCC
5
3918
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 record. Details: DB with one main table and several list (reference) tables. I want to populate several list boxes on one form based on a choice from a combo box. Example: Tables:
5
4012
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 Fields Names: countrycode, make
2
2256
by: RhysPhelps | last post by:
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...
5
4181
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 box is active and find a record based on user input. The list box gets its values from the combo box and the list box can also change the form to the record chosen by the user. The list box and combo box are on the same form.
0
9710
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
9589
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
10593
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...
1
10329
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
10085
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
5527
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...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3000
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.