Setting more than one primary key field?

  • Thread starter Thread starter Randy
  • Start date Start date
R

Randy

When I set up a table I set the autonumber as a primary key. Now I
need to add three other fields as primary key fields.

Can this be done? How?
 
Randy said:
When I set up a table I set the autonumber as a primary key. Now I
need to add three other fields as primary key fields.

Can this be done? How?

A table can have exactly one primary key. That one key however can consist
of anywhere from one to (ten?) fields. One can also define unique indexes
in a table again consisting of one to ten fields that can exist alongside
the Primary Key. This latter is what you need.

Creating multi-column indexes that are not the PK is not one of the more
obvious things to do in Access. You need to open the table in design view
and then go to "View Indexes" in the menu. Then you enter your index like
this...

IndexName Field1Name
Field2Name
Field3Name

(At the bottom) Unique = Yes.
 
Look up "composite primary key" on the net. Most of the time you have to
create this type of primary key because the table is an associative entity
remedying a many-to-many relationship.
 
Back
Top