how can I make sub categories in access database?

J

Jeff Boyce

This is a fairly cryptic post -- what do YOU mean by "make sub categories"?
Are you describing a data structure question, or a forms question, or a
query question, or ...?
 
W

wessam

I'm asking about data structure.. I have a lot of categories in my data
base.. I want to divide them into sub categories..
How can I do that?
 
J

John Vinson

I'm asking about data structure.. I have a lot of categories in my data
base.. I want to divide them into sub categories..
How can I do that?

One common way is to have a self-referential Category table:

Categories
Category
ParentCategory

This table is related to itself, with a one (ParentCategory) to many
(category) join in the relationships window. A toplevel category has a
NULL in its ParentCategory field. This gives you any desired number of
layers of sub, sub-sub-, sub-sub-sub- categories. Your item table
would then refer to a specific category (at any level), and you can
use a join from MainTable to Categories to Categories to see that
category's parent.

John W. Vinson[MVP]
 
P

(PeteCresswell)

Per wessam:
I'm asking about data structure.. I have a lot of categories in my data
base.. I want to divide them into sub categories..
How can I do that?

Depends on what a "category" or "subCategory" is.

Can one entity be in many categories/subcategories or just one?


OTOH, maybe you're describing a hierarchical structure where different
bottom-level entities can have varying numbers entities above them in a
hierarchy.

viz:
---------------
Vendor
Database
Table
Field
---------------
vs
---------------
Vendor
FeedStream
Field
---------------



The first case would involve a link table between the parent table and the table
containing category names.

e.g.
tblFund---tblFundCategory---tlkpCategory


The second case would involve recursive relationships.

One table with each item having an optional "Parent" - which I cannot figure out
how to represent within the confines of ASCII text...-)
 
Top