A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Multiple Primary Keys



 
 
Thread Tools Display Modes
  #1  
Old July 16th, 2004, 08:50 PM
Mike
external usenet poster
 
Posts: n/a
Default Multiple Primary Keys

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
  #2  
Old July 16th, 2004, 09:01 PM
Rick B
external usenet poster
 
Posts: n/a
Default Multiple Primary Keys

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


"Mike" wrote in message
...
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


  #3  
Old July 17th, 2004, 06:57 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default Multiple Primary Keys

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)



"Rick B" wrote in message
...
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





  #4  
Old July 19th, 2004, 01:26 PM
external usenet poster
 
Posts: n/a
Default Multiple Primary Keys

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
-----Original Message-----
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)



"Rick B" wrote in

message
...
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





.

  #5  
Old July 19th, 2004, 02:56 PM
Craig Alexander Morrison
external usenet poster
 
Posts: n/a
Default Multiple Primary Keys

You can only enforce RI at engine level using the Primary Key.

--
Craig Alexander Morrison
wrote in message
...
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




  #6  
Old July 19th, 2004, 05:06 PM
John Vinson
external usenet poster
 
Posts: n/a
Default Multiple Primary Keys

On Mon, 19 Jul 2004 14:56:30 +0100, "Craig Alexander Morrison"
wrote:

You can only enforce RI at engine level using the Primary Key.


correct... but a Primary Key can consist of one to ten fields.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
  #7  
Old July 19th, 2004, 05:12 PM
Craig Alexander Morrison
external usenet poster
 
Posts: n/a
Default Multiple Primary Keys

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.

--
Craig Alexander Morrison
"John Vinson" wrote in message
...
On Mon, 19 Jul 2004 14:56:30 +0100, "Craig Alexander Morrison"
wrote:

You can only enforce RI at engine level using the Primary Key.


correct... but a Primary Key can consist of one to ten fields.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public



  #8  
Old July 19th, 2004, 05:53 PM
Craig Alexander Morrison
external usenet poster
 
Posts: n/a
Default Multiple Primary Keys

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.

--
Craig Alexander Morrison
"John Vinson" wrote in message
...
On Mon, 19 Jul 2004 14:56:30 +0100, "Craig Alexander Morrison"
wrote:

You can only enforce RI at engine level using the Primary Key.


correct... but a Primary Key can consist of one to ten fields.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Primary Key not sorted Mike Database Design 6 June 16th, 2004 11:11 PM
Primary Keys js New Users 5 June 8th, 2004 11:36 PM
Choosing Primary and Foreign Keys A.V.H New Users 8 May 23rd, 2004 09:12 PM
Primary Keys and Relationships TR Database Design 2 May 23rd, 2004 03:19 AM
Multiple Conditions and Multiple Solutions Frank Kabel Worksheet Functions 0 February 4th, 2004 09:22 PM


All times are GMT +1. The time now is 05:25 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.