Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if there is more than one primary key 1

Status
Not open for further replies.

Newton

Technical User
Apr 5, 2001
26
CA
I am wondering if I use more than one primary key, how Access will handle the integrity.

If I wanted to have all records be unique based on a combination of two fields do I just make both of those fields primary keys.

ie) ProjectID + Building number (having both of them be primary keys. Does that mean I can still have 2 building 112 so long as they are not both under the asme projectID?

I want my user to be able to search based on project, then building number. There would never be two building numbers the same in a project, but I am just not sure that Access primary keys are thinking in terms of "and" instead of "or"

what do you know?
 
I use double and sometimes triple keys all of the time, it is not a problem. Some people may suggest making autonumber keys, but I believe that multiple keys are fine.
 
Does it work the way I decribed though where the uniquness of a record is defined by both the keys?

project 1 building 100
project 2 buliding 100

would it allow that
 
It thinks in terms of AND, therefore you can have two building 112's as long as they are not in the same project. It will treat them as different.

So, yes it works the way you described.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top