multiple entry of a number

S

suej68

I have a database that requires a payroll number to be entered multiple
times, the payroll number is the primary key and a number of reports are
required to be printed out. the data base works wonderfully until you want to
enter the payroll number again for another record and it doesnt like it, how
to I get around this.
 
S

Steve Schapel

Sue,

If the payroll number is the primary key, the values in this field *must
be* unique. That's part of the meaning of the concept of primary key.
You won't be able to enter the same payroll number more than once in
this table.

Sorry, I don't think I can advise more specifically than that, without
knowing more about your overall database and the purpose of this and any
related tables.
 
L

Linq Adams via AccessMonster.com

As Steve has explained, a Primary Key has to be unique(i.e. can only be used
once) to a given table. The number can only be used again in a related table,
where it becomes a Foreign Key. The Foreign Key can be use multiple times in
this related table.

A simplified example would be:

PayrollTable:

PayrollNumber - Primary Key (Can only appear once in this table)
StartDate
EndDate

PayDayTable:

EmployeeID
PayrollNumber - Foreign Key (Can appear multiple times in this table)
EmployeeHours
 
Top