Multiple Primary Keys

M

Mike

Hello,

Can I have 2 primary keys where Access requires that they
are both not the same. For example...

Field1 Field2
a 1
a 2
b 2

Would all be acceptable?

Thanks
 
R

Rick B

Yes,

In table design view, click the frst field, hold down the CTRL key and click
the second. They should both be highlighted. Click the "key" icon.

To change the properties of your new compound key, or just to see them, go
to the View menu and select 'Indexes'.

Hope that helps,

Rick b


Hello,

Can I have 2 primary keys where Access requires that they
are both not the same. For example...

Field1 Field2
a 1
a 2
b 2

Would all be acceptable?

Thanks
 
V

Van T. Dinh

Note also that Rick described the *multi-Field* PrimaryKey, not 2 separate
PrimaryKeys. Each Table can only have at most 1 PrimaryKey.

HTH
Van T. Dinh
MVP (Access)
 
G

Guest

Shoot, here's what I forgot to explain. I would really
like multiple keys with referential integrity. I should
have said that in the original post. My bad.
Mike
 
C

Craig Alexander Morrison

Yes, but I took the latest answer to mean he wanted to cascade on more than
one index (as opposed to field).

Prinary Key is really an Index as opposed to a field.
 
C

Craig Alexander Morrison

Actually John, I think you can enforce RI at the engine level on any unique
index (simple or compound), it seems to work in both 97 and 2002/2003.

Well I never!

Apologies for my error in assumption. I've been using various versions of
access since 1992, and a wee bit before then - this is the first time I
tried it.

Mind you I have never needed it.

Oooops! Sorry for the misleading information.
 

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