Using MS Access/Cascading Combo Boxes

Advertisement


Question
Hi,
I am trying to create categories and sub categories for an inventory database and followed your instructions on cascading combo boxes from 12/21/2004.  I am using Access 2010 and was just wondering how the data should be entered into the tables (I wasn't clear on how the filter would work if the tables themselves just have the one field):
My Categories are:
CategoryGroup (Category in your example)
CategoryMain (Sub Category in your example)
CategorySub (Item in your example)

My CategoryGroup Table has CategoryGroupID (autonumber) and CategoryGroupName:
Copper Cable
Copper Connectivity
Electronics
Fiber Cable
etc.

How should I enter data in the CategoryMain and CategorySub tables so that it will filter properly.

Thank you!

Answer
Hard to remember what I wrote 10 days ago let alone 10 years ago, ;)

If I'm following you, you have Products (CategorySub) you are tracking inventory for. Each of these items have a category and a subcategory. The question I have for you is whether a subcategory is exclusive to a category or subcategories can apply to multiple categories.

Assuming that a subcategory is exclusive, you need two tables:

tluCategory
CategoryID (PK Autonumber)
Category

tluSubCategory
SubCategoryID (PK Autonumber)
SubCategory
CategoryID (FK)

Now your Items table would look like this:

tblItem
ItemID (PK Autonumber)
ItemDescription
SubCategoryID (FK)
UnitPrice
etc.

So your subcategory Combobox would have a RowSource like:

SELECT SubcategoryID, Subcategory
FROM tluSubCategory
WHERE CategoryID = Forms!formname!cboCategory;

Hope this helps,
Scott<>  

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scottgem

Expertise

I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience

I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Education/Credentials
Brooklyn College BA

©2016 About.com. All rights reserved.