Primary keys

A

alvin Kuiper

Hej
In my table i have a primary key
but in the same table i want two other fields
to be Uniq togheter, i know i can do it whit Primary keys
but how to do this, when i all ready have a primary key?

Regards
alvin
 
W

Wayne-I-M

Hi

It depends on the use that you will put the fields to, also if you want the
field contents to be unique (only 1 John, only Mary, only 1 Smith, Onl;y 1
Jones, etc) or if you want a combination of the fields to be unique (only 1
John Smith or only 1 Jane Jones, etc)

You can have multiple fields as the primary. - opn the table in design view
and select the fields then right click and select primary.

To make a field unique - select View then Indexes and insert the field into
the list.

To make a comination of the fields uniques - Select View then Indexes and
insert both (or all) the fields into the Field Name Coloumn and then (in the
Index Name Column) give them all the same name - like address, name, etc.

Hope this helps
 
T

TedMi

You can have only one primary key which is unique by definition, but you can
have many unique indexes on non-primary fields. Just mark the index as Unique
when you create it.
 
A

alvin Kuiper

Thanks
Can i understand it like this

If i Call the index name the same for two fields
then i have a uniq combination off this two?

Regards
alvin


"Wayne-I-M" skrev:
 
T

TedMi

Close, but not quite. To create an index on two fields, enter an index name
in the left column, select a field for the right column. Then, on the next
line, leave the index name column blank and select a field for the right
column. That index then becomes a compound index on the two fields. You can
then mark it unique, which will allow a combination of records such as this:
Sam Jones
Ted Jones
Ted Smith
Verna Smith
 

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