473,486 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to limit Combo Box depending upon other Combo Box

102 New Member
Hello friends,I am again stuck & need your help.
I have a a table with 2 columns
Column1 (Area) like 3A, 3U, 4A, 4U,5A, 5U, 6A, 6U
COLUMN2 (Systems) like AY, FC, HD, IA, LC, LS, P, SY, UA,etc

Some Areas are link with some system. Not All Area to All system.

I want to select one Area from Combo Box like 3A
and I want only system display from other Combo Box which are associated with Area 3 (Not All)

So this easy task I can not perform and requesting for help. Either to perform it via Query or VBA Code..
Thanks in advance..
Irshad Ahmed
Jan 21 '12 #1
8 1956
C CSR
144 New Member
I assume you have a relation between Area and System like this:

Expand|Select|Wrap|Line Numbers
  1. A1    s1
  2. B2    s1
  3. B2    s2
  4. B2    s3
  5. C3    s1
  6. C3    s2
  7. C3    s3
  8. C3    s4
  9. C3    s5
  10.  
  11.  
The basic steps are to Query data for first Combo, then use the selected item to populate the second Combo.

Get list for first Combo (EXAMPLE)Onopening the form:

Expand|Select|Wrap|Line Numbers
  1. SQL1 = "SELECT ForCombos.fArea FROM ForCombos GROUP BY ForCombos.fArea;"
  2.  
  3. Me.Combo1.RowSource =  SQL1
  4.  
Then when an item is selected from Comb1(Onclick event) :

Expand|Select|Wrap|Line Numbers
  1. AREA_SEL = Me.Combo1
  2.  
  3. SQL2 = "SELECT ForCombos.fArea, ForCombos.fSystem FROM ForCombos WHERE (((ForCombos.fArea)='" & AREA_SEL & "'))"
  4.  
  5. Me.Combo2.RowSource =  SQL2
  6.  
Jan 21 '12 #2
C CSR
144 New Member
Make sure Combo2's "Bound Column" in properties is set to 2 for "ForCombos.fSystem," or just take out the first "ForCombos.fArea" in the SQL2
Jan 21 '12 #3
NeoPa
32,556 Recognized Expert Moderator MVP
Are you going to explain how one could tell which systems are associated with which area? The question makes no sense without that important information.
Jan 24 '12 #4
irsmalik
102 New Member
Please find attached a test.mdb containing data. One Table "System" have 2 fileds Area and System. Now I want to make a form containing 2 combo box for Area & System. When select one area from first combo, its associated systems must be in the second combo / list box.
There is an other table "Process" when both combo box are selected, it will run query / report which shows record from Process depending upon the selection of combo box.
Jan 24 '12 #5
C CSR
144 New Member
Did you try the suggestions I posted (#2 & #3)? They will work.

After someone selects the System in the 2nd combo, you just need to decide how and where the report pops up.

Also, I would disable the 2nd combo box until a selection is made from the first (that's gonna be a design issue). Use the "OnChange" event of the 1st combo to enable the 2nd combo and fill it with the query run using as criteria the selected Area from the 1st.

Then, when a selection is made from the 2nd combo, use the 1st and 2nd combo selections as criteria for narrowing down to a specific "Process." So you'd have a final query with both selections in it. Not knowing whats in the table, I would hope that it would return one record.

Your attachment didn't show up. Let me know if you've tried the queries yet. If the queries give you what you want, then you can assign them to the appropriate combo box(s).
Jan 24 '12 #6
irsmalik
102 New Member
Dear CSR
As I am new to Access / SQL, Im sorry I could not understand your idea.
This attachment is for Mr Neopa.
If U please look into this table, U will have a better idea what I want.
Thanks for your pain.
Jan 24 '12 #7
NeoPa
32,556 Recognized Expert Moderator MVP
Irsmalik:
Please find attached a test.mdb containing data
No. No. No. No. No.

You please ask your question properly and don't expect others to work it out for you by looking through your database. That's disrespectful and means that you still haven't posted an adequate question (I should have deleted it before it got to this stage but it's probably too late now).

When asked for basic information that should have been included in the original post I suggest you supply that information.

As it happens you didn't even attach any database, which is probably just as well.
Jan 24 '12 #8
ChrisPadgham
11 New Member
set the rowsource of the second combo to include a WHERE statement referencing the first combo

Expand|Select|Wrap|Line Numbers
  1. combo2.rowsource = "SELECT ID, F2 FROM T2 WHERE (((T2.T1ID)=[Forms]![Form1]![Combo1]));"
in the click event of combo1 requery combo2

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo1_Click()
  2. Me.Combo2.Requery
  3. End Sub
  4.  
Jan 24 '12 #9

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

Similar topics

3
1556
by: param | last post by:
Hi, I need to write a MACRO which helps to call different functions depending upon it's value say On or OFF. If its' value is ON the function1 should get called and if value is OFF function2...
6
6257
by: suresh Chowdary | last post by:
Hi All, depending upon text box entry i want to show drop down box with respective values. means if user enters 'ls' in the text box i want to show the values like 'she','he' in dropdown box it...
9
1549
by: rajasekhar | last post by:
Hallo, I am developing a site, and here whats the problem is: how to partition the code, i.e. if I developed 1000 lines of code, in that I want to show first 200 lines only if the user opens my...
3
1366
by: Iyhamid | last post by:
Hi Every 1 I am still in big problem.. And I would like help..As u guys always do thanks to all.. My problem is that: I have A view with multible columns..Merchant ID(numbers), Merchant...
0
1033
by: sunilkds | last post by:
I want to main difference simple Combo box & DataCombo Box @ VB6.0 What is combox.listindex in DataCombo
6
4281
by: mfaisalwarraich | last post by:
Hi Everyone, I am new to javascript. I want to load 3 forms which depends upon the selection of a value from Combo Box. For example i have a combo box on a page and it has three values Form1,...
9
1523
by: jay123 | last post by:
hi all, what i am trying to do is i have three folders 1) sentto 2) error 3) sent i am using web services in which we give the name of XML file ( which is in sentto folder. when the name...
3
1497
by: Edward Gorman | last post by:
Hello Everyone, I'm having abit of difficulty with an aspect of Access. I wish to create a query which changes a persons wage depending upon their age. This is what I have done so far: SELECT...
0
821
by: GR M | last post by:
I have a unbound datadridview named dgv_add, which contains columns of type datagridviewcolumn types and the another column of type datagridviewcombobox type. I want to add specific items from a...
2
1261
by: Yousaf Shah | last post by:
Hello everybody Actually I am a beginner with MS Access and want to make my own data base for my patients (as I am Surgeon by profession). I explain you my new query... Suppose we have two bound...
0
7099
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
6964
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
7123
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
7175
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...
0
5430
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
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
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
262
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.