2 Combo Boxes

irishcavan

Registered User.
Local time
Yesterday, 19:34
Joined
Nov 2, 2005
Messages
15
I am trying to set up 2 combo boxes in my form. The first one holds the Category and the second on holds the Sub Category. I would like the second combo to only pull Sub Categories pertaining to the Category selected.

I have the Category fields set as: CATID, CATEGORY
I have the SubCategory fields set as: SUBCATID, CATID, SUBCATEGORY

I don't know if I set this up properly, so help would be greatly appreciated.


Regards,
Irish
 
Firstly have Category combos control source bound to a query to return all the category items.
SELECT Category, CatId FROM CATEGORY ORDER BY Category ASC

Then, for the subcategory combo - set the control source for this one to a query that references the value, of the selected item in the category combo, like this :


SELECT SUBCAT.CatId, SUBCAT.SubCategory FROM SUBCAT
WHERE (SUBCAT.CATID)=[Forms]![CategoryForm]![cboCategory])
ORDER BY SUBCAT.SubCategory;

Be sure to set the 'category' combo to 2 columns with the columns widths set to (10;0) this will hide the second column - the id field and the bound column (the one that Access uses to check the reference to the subcategory) as 2.
 

Users who are viewing this thread

Back
Top Bottom