By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,480 Members | 2,953 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,480 IT Pros & Developers. It's quick & easy.

Combination Primary Key

P: 4
Thanks for your help with my switchboard question it was of great help. One more question I have to use access for this Uni project
one of my tables have a combination primary key how do I join it to another table. Iíve tried access help and my research books can't find a answer feel its quite simple would really be grateful for help. Have to make it combination as code and date both needed to make unique key the code already been given us
Nov 20 '06 #1
Share this Question
Share on Google+
1 Reply


MMcCarthy
Expert Mod 10K+
P: 14,534
Thanks for your help with my switchboard question it was of great help. One more question I have to use access for this Uni project
one of my tables have a combination primary key how do I join it to another table. Iíve tried access help and my research books can't find a answer feel its quite simple would really be grateful for help. Have to make it combination as code and date both needed to make unique key the code already been given us
A double primary key is usually used when joining two tables with a many to many relationship.

e.g. tblCustomers and tblSuppliers

Customers have many Suppliers and Suppliers supply many Customers. This is known as a Many to Many relationship. In this case a join table is created tblCust_Supl. This table would have a double primary key CustID the primary key from tblCustomers and SuplID the primary key from tblSuppliers. This allows for tblCustomers to join tblCust_Supl and for tblCust_Supl to join to tblSuppliers. The reverse also of course.

Now if this is not the case with your design I would recommend Creating a new field ID (type Autonumber) to act as the Primary Key rather than the two fields you are currently using.

To follow your current path you would have to create a double join to two foreign keys in each of the tables you're trying to join to your main table and this is very bad design and should never be done without a very good reason.
Nov 20 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.