3 Field Primary Key

G

Guest

Is it possible to create a 3 Field Primary Key?

If this is possible, are there any special rules I should be aware of?

If a 3 Field Primary Key is not possible, is there a way to create a
connection between 3 fields so that duplicates are not allowed (comparing the
3 fields), similar to a primary keys function of not allowing duplicates?
 
J

Jason Lepack

Is it possible to create a 3 Field Primary Key?

Yes, click on "View" Indexes. Put the name for the index in the left
column, first row, and the three fields in the right column. To mke it
primary, select that option.
If this is possible, are there any special rules I should be aware of?

The larger your index the longer it will take to perform inserts and
updates but querying should be shorter.
If a 3 Field Primary Key is not possible, is there a way to create a
connection between 3 fields so that duplicates are not allowed (comparing the
3 fields), similar to a primary keys function of not allowing duplicates?

You don't need to make your index primary, just unique.

Cheers,
Jason Lepack
 
G

George Nicholson

- In TableDesign view, View>Indexes

- Create a new Index with IndexName of Unique (or whatever). Select your
first field under Field Name & Set the Unique property to Yes.

- on the next 2 lines, leave IndexName empty & select your next 2 fields
under Field Name. (Note: leaving IndexName empty is what associates these
fields with Field#1 in the Index).

Done.

You can set this Index to be the Primary Key if you like, but Unique will
probably satisfy the "don't duplicate the combination of these 3 fields"
rule just as well.

If any existing records violate the rule you just set up, Access will let
you know when you try to exit table design. You'll have to find & fix the
violations and then come back & set up your unique index again.

HTH,
 
R

RoyVidar

Nanette said:
Is it possible to create a 3 Field Primary Key?

If this is possible, are there any special rules I should be aware
of?

If a 3 Field Primary Key is not possible, is there a way to create a
connection between 3 fields so that duplicates are not allowed
(comparing the 3 fields), similar to a primary keys function of not
allowing duplicates?

Select the fields in question by holding ctrl while clicking the field
selctors (grey buttons to the left of the field). Then hit the primary
key button in the toolbar, alternatively right click to the right of
the field selectors of one of the selected fields, select Primary Key.
 
G

Guest

Thanks everyone!

RoyVidar said:
Select the fields in question by holding ctrl while clicking the field
selctors (grey buttons to the left of the field). Then hit the primary
key button in the toolbar, alternatively right click to the right of
the field selectors of one of the selected fields, select Primary Key.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top