How do I set a group of fields to be the Primary Key

H

huzzlepuzzle

Hi there - would be grateful if someone can advise I havent worked in access
in a long time and I have forgotten more than I know!,

i'm trying to create a structure as below:

Customer - has many sites per customer

SiteID (Primary Key) - can have many entries against it which are only
individual by grouping the fields:
Site ID
The Year
Month
MissType

And to complicate further - this group then will have many elements and
fields against it with field names:
Feature
Charge

is this possible to create?

Thanks for advice
 
S

Sharkbyte

Hazel:

If I am reading this right, this is what you might be looking for:

tblCustomer
CustomerID (PK)
CustomerName

tblSites
SiteID (PK)
CustomerID (FK)
Year
Month
MissType
*Unique index CustomerID, Year, Month, MissType

tblSiteSpecs
SiteID (FK)
Feature (PK)
Charge (PK)

Let me know if you meant something different.

Sharkbyte
 
J

John Vinson

Hi there - would be grateful if someone can advise I havent worked in access
in a long time and I have forgotten more than I know!,

i'm trying to create a structure as below:

Customer - has many sites per customer

SiteID (Primary Key) - can have many entries against it which are only
individual by grouping the fields:
Site ID
The Year
Month
MissType

I'd avoid using blanks in fieldnames; but you can use up to ten fields
for a PK. Open the table in design view, ctrl-click all of the fields
which comprise the primary key, and click the Key icon. None of the
fields may be NULL, but any individual field can have repeated values;
you just can't get any records which duplicate all four.

John W. Vinson[MVP]
 
H

huzzlepuzzle

Thanks for all your help
Kind Regards

Hazel


John Vinson said:
I'd avoid using blanks in fieldnames; but you can use up to ten fields
for a PK. Open the table in design view, ctrl-click all of the fields
which comprise the primary key, and click the Key icon. None of the
fields may be NULL, but any individual field can have repeated values;
you just can't get any records which duplicate all four.

John W. Vinson[MVP]
 

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