How to put Two primary keys in one table (1 Viewer)

ccoogan

New member
Local time
Yesterday, 19:25
Joined
May 7, 2012
Messages
2
Two primary keys in one table
I am working in access 2010 and need to place two primary keys in one table. These two primary keys are also FK's, how do you do this? Ive have attached an example of what someone else did. The table I want to do this to is the assignment table in the attachment. i have read other posts and all I have seen say it cannot be done but in the attachment it was done.
 

Attachments

  • image001.jpg
    image001.jpg
    90.4 KB · Views: 2,032

Mr. B

"Doctor Access"
Local time
Yesterday, 21:25
Joined
May 20, 2009
Messages
1,932
With your table in design view, select the fields you want to make into Primary Key fields. If they are adjacent to each other you an simply click in the left margin area of the table design view and drag to select the desired fields. If they are not adjacent to each other you can select the first field and then hold down the ctrl key and select the other field. With the fields selected click the "Primary Key" button in the menu. Both fields will become primary key fields.
 

ccoogan

New member
Local time
Yesterday, 19:25
Joined
May 7, 2012
Messages
2
Thank You!!! Never though of doing that but it makes sense.
 

Mr. B

"Doctor Access"
Local time
Yesterday, 21:25
Joined
May 20, 2009
Messages
1,932
You are welcome. Glad to help.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 03:25
Joined
Sep 12, 2006
Messages
15,652
just to be precise - this is not 2 primary keys. this is a single primary key, which happens to comprise multiple fields.
 

Users who are viewing this thread

Top Bottom