View Full Version : Combining tow fields to make a primary key


Jeanette
12-04-2003, 01:29 PM
Hello all, I have a table with two fields set as primary keys to form a unique identification. I want to use these fields as a lookup column in another table and be able to enforce referential integrity. I tried doing the lookup field using only on of the primary keys, and I cannot enforce referential integrity. Can any tell how to get referential integrity by using both of my primary keys? Thanks in advance.

Pat Hartman
12-04-2003, 06:59 PM
If you need to use this table as a lookup, it will be easier if you use an autonumber as the primary key and create a unique index on the two fields to enforce the business rules. You would also use the autonumber field as the foreign key.

There is no problem using multi-field primary keys or in enforcing RI on relationships to these tables. The only awkwardness is if you need to use them in a combo.