How do you assign two primary keys?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I need to assign two primary keys in a table. I pulled up the help file
and it says I can but I can’t find how to do it. When I click on a row to
make it the primary key the other cancels the other one I have set. I am
using Access 2002. I am trying to set up a customer order database similar to
the North wind sample.

Thank you,
James
 
James said:
Hi, I need to assign two primary keys in a table. I pulled up the
help file and it says I can but I can’t find how to do it. When I
click on a row to make it the primary key the other cancels the
other one I have set. I am using Access 2002. I am trying to set up
a customer order database similar to the North wind sample.

Thank you,
James

There's only one primary key, but it can contain more than one field.

Select the fields you wish to be part of the compound primary key (hold
ctrl while clicking the grey "field selectors"), then hit the primary
key button on the toolbar (or right click to the right of the grey
"field selectors", and select primary key)
 
James said:
Hi, I need to assign two primary keys in a table. I pulled up the
help file and it says I can but I can't find how to do it. When I
click on a row to make it the primary key the other cancels the other
one I have set. I am using Access 2002. I am trying to set up a
customer order database similar to the North wind sample.

Thank you,
James

You cannot assign two PK to a single table, but you can have ONE PK that is made
up of two or more fields. Just hold the control key while selecting the fields
in design view of the table and then press the [key] button in the toolbar.
 
Back
Top