If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Using a table of 'Categories' to specify which table to reference

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-23-12, 07:08
Alfihar Alfihar is offline
Registered User
 
Join Date: Jan 2012
Posts: 1
Using a table of 'Categories' to specify which table to reference

Heres the scenario

I have one table for Borrowers with personal details

I have three tables (one for each category of item) called Books, Videos and CDs. These each have different types of fields. I want to be able to add further categories later (adding more tables)

One Borrower can have multiple Items.
One Item can have multiple Borrowers (weird I know but needed).
I would also like to specify a category and display all the Borrowers that have a Item of that category.

I want to be able to search an Item and see which Borrowers are associated with it and vice versa.

How do I go about making a Junction between a Borrower and a Record from one of the item tables based on category?

I figured a table of 'categories' would be needed but im not sure how to link it all up.

Thanks
Reply With Quote
  #2 (permalink)  
Old 01-23-12, 08:12
myle myle is offline
(Making Your Life Easy)
 
Join Date: Feb 2004
Location: New Zealand
Posts: 1,143
My question is why have a table for each category that going to make it harder for find anything
But in saying that

As long as each table has the borrowerid in it that will

Using you model I would create a catEgory table
With
Categoryid = pk
Borrowerid = pk form the borrower table
Category_table = the table name
Adate =autodate when it was added
.... Could add the category_table Id have but think it could be a overkill

But the you have to write some code so that when one of the other tables are updated you have to update the cat table also

This is me thinking out loud ok
__________________
hope this help

See clear as mud


StePhan McKillen
the aim is store once, not store multiple times
Remember... Optimize 'til you die!
Progaming environment:
Access based on my own environment: DAO3.6/A97/A2000/A2003
VB based on my own environment: vb6 sp5
ASP based on my own environment: 5.6
VB-NET based on my own environment started 2007
SQL-2005 based on my own environment started 2008
MYLE
Reply With Quote
  #3 (permalink)  
Old 01-23-12, 08:24
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
having separate tables for books, videos, and cds makes good sense, since they have different attributes (columns)

what's missing is a supertype table, and that's what you would link to the borrower table

alfihar, do a search for supertype/subtype
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On