Trouble with Composite Keys

MakinBacon91

New Member
Joined
Sep 8, 2015
Messages
47
Hello all,

I am having trouble with making a composite key.
Here is a picture with my table, the error, and table design view below: Pasteboard — Uploaded Image

I have a table with all of the Customer Abbreviations, that is a primary key for that table.

In the Job info table, Customer Abbreviations will not be unique, and Job number will not be unique,
But the combination of Customer Abbreviation with Job number will be unique.

Any thoughts on how I can achieve this type of data structure?

Thanks,
Bacon
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hello all,

I am having trouble with making a composite key.
Here is a picture with my table, the error, and table design view below: Pasteboard — Uploaded Image

I have a table with all of the Customer Abbreviations, that is a primary key for that table.

In the Job info table, Customer Abbreviations will not be unique, and Job number will not be unique,
But the combination of Customer Abbreviation with Job number will be unique.

Any thoughts on how I can achieve this type of data structure?

Thanks,
Bacon

I have been doing some research, to no avail yet, but I thought I would mention I am also looking into using a Multi-Field Unique Index.

Edit:
Also, I think I found one of my problems.
The table with Customer Abbreviations is linked 1-1 with my Job Info Table.
 
Last edited:
Upvote 0
Haha,

Yeah, I figured this one out!!
I just had to go in to the Relationships display, delete the relationship between Customer Table and Job Info Table, then recreate the link checking the "Enforce Referential Integrity" box.

Thanks guys!

Edit: I used a Multi-Field Unique Index, instead of a primary key.
 
Last edited:
Upvote 0
Haha,

Yeah, I figured this one out!!
I just had to go in to the Relationships display, delete the relationship between Customer Table and Job Info Table, then recreate the link checking the "Enforce Referential Integrity" box.

Thanks guys!

Edit: I used a Multi-Field Unique Index, instead of a primary key.

Thanks for sharing your solution.

I used a Multi-Field Unique Index, instead of a primary key.

I always do that. Stick with that as you will have a lot less headaches. I have never seen the requirement that had to use composite (multi-field) primary key in 30+ years with 1000+ database. Not a single PC database like access Access to client sever database like SQL Servers, and even mainframe database. I always been able to use anything but a single field, system assigned, primary key. I do create an index with multiple fields.
 
Upvote 0

Forum statistics

Threads
1,221,832
Messages
6,162,255
Members
451,757
Latest member
iours

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top