Avatar of wlwebb
wlwebb
Flag for United States of America asked on

Access - Table Design related to creating a Classification Type and Classification SubType

Hello All

As most all of you know I am "Hacking" around at this whole Access thing.  With your all's Expert help I have learned a tremendous amount.  Thank you.

Now then I am considering/pondering how to break down some information and am contemplating using a Classification Type and a Classification Sub Type.

For the purpose of this discussion, I will use an Example framed like say Suppliers....

So let us say I have a Table called
dta_Suppliers

In that Table I would have fields
SupplierID - PK Autonumber
SupplierCode - Text
SupplierName
etc....

Now then, in order to Classify Suppliers into various groups I envision a Table called
SupplierType

In that Table I envision fields
SupplierTypeID - PK - Autonumber
SupplierType - Text

HOWEVER I would also like to have SubType Classification ability.  So therefore I envision creating a Table Called
SupplierTypeSub

In that Table I envision fields
SupplierTypeSubID - PK - Autonumber
SupplierTypeSub - Text


That all is simple enough.  I could just put a field in the Supplier Table for each Type and TypeSub.  However, if I do that I know I'll end up with all kinds of Combinations of Type and TypeSub which would probably render the info useless in the long run.

SO, I thought about Controlling that by creating a Many To Many table called
ctl_SupplierTypeToTypeSub

In that table I would have:
SupplierTypeID - PK
SupplierTypeSubID - PK

HOWEVER if I do it that way, I presume that I would then either I have to put a record called {None} or {N/A} in my SupplierTypeSub table and every time a new SupplierType classification gets created I would have to populate the ctl_SupplierTypeToTypeSub table with that new SupplierType and the {None} TypeSub. (Again, my presumption but not 100% confident I'm right in this presumption)

If I don't use this Many-Many type table method but just simply have two fields within the Supplier Table 1 for SupplierType and then 1 for SupplierTypeSub Is there a way in the SQL of the SELECT statement for SupplierTypeSub that would limit the user to selecting a TypeSub based on what Management has defined as the way they want the SupplierType to SupplierTypeSub to relate?

So my question is this:
Based on what I am attempting, from your all's experience is there one method preferrable long-term over another. And is my thinking correct here at all?
Microsoft Access

Avatar of undefined
Last Comment
wlwebb

8/22/2022 - Mon
als315

Usually Many-to-Many table is used near beginning, ie when one supplier has many subtypes and they are joined to Type.
For example, "SupplierA" has  subtypes: "Water", "Wine", "Beer", when "SupplierB" has only one subtype "Water".
Table Supplier-Subtype has both IDs (Supplier and subtype) and in index both IDs are included.
Table for SubType has FK from table Types, where all subtypes above joined to type "Drinks"

Try to describe real task, design may vary, but you should follow physics.
Jim Dettman (EE MVE)

<<Based on what I am attempting, from your all's experience is there one method preferrable long-term over another. And is my thinking correct here at all? >>

 Well let's start with some examples of what you mean by type and subtype...

 The questions that need to be answered are:

1. Can a vendor have more then one type? (yes)
2. Can a type have no sub types or must it always have one?
3. Can a type have more then one sub type?
4. Can the same sub-type apply to more then one type?  

 For example: vendor type is "Pool Supplies" and another is "Fish Tanks".  Sub type in both cases is "water".

  You need to say if the sub-type relates specifically to the type, or if a sub type is just another classifcation of vendors rather then types.

Jim.
wlwebb

ASKER
Ok I see your points...  

So let us change then that it is Addresses....

An Address can have many Types and Subtypes..... The Types can have Many subtypes

For Example

If I have a one table of addresses and I want to relate that table to Contacts and Vendors and Employees etc....

So then my Address Types could be

Home Address
Business Address
Physical Address
Mailing Address
Alt Mailing Address
Ship To Address
AP Address
AR Address


Home Address could be a subtype of
Resident Home
Vacation Home
Winter Home
Summer Home
etc...

Business Address Subtypes could be
Corporate Headquarters
Branch Office
Main Warehouse
Branch Warehouse
Accounts Payable Processing
Accounts Receivable Processing
etc...

So if I want to maintain addresses separate from essentially the Contact but classify them whether they are Contacts or Customers or Vendors or Inventory Suppliers or Employees etc

So to answer the question then, for Each of those essentially Contact types then each could in fact have multiple addresses with multiple Address Types and the Address Type could have Address Sub Types.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
als315

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Jim Dettman (EE MVE)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
wlwebb

ASKER
Thank you both.  I have some more pondering to do on how far I want to take this...