View Full Version : Foreign key


UnitedWeFall
06-08-2007, 12:54 AM
Hey all, i'm new here! I've spent hours upon hours trying to solve this problem, but it's got me nowhere, so I think it's time to ask for help! I'm not exactly an Access beginner (I generally know what i'm doing) but this has me stumped!

Ok, basically my DB has several tables.

Staff (main table)
Qualifications
Institutions

The problem is - i'm trying to set it up so the fields "qualificationName" and "institutionName" in the staff table extract the data from the fields with the same names in the qualifications/institutions tables.

I've tried linking the fields together as foreign keys, but when I go to set referential integrity, I get the error "No unique index found for the referenced field of the primary table"

staffID in each table is linked properly, but that's as far as it will let me go!

Any help would be really appreciated!

RuralGuy
06-08-2007, 03:46 AM
This is done with a query and not at the table level.

UnitedWeFall
06-08-2007, 04:02 AM
Are you sure? I've done this before at the table level - it's only the error that's stopping me this time I believe.

By "extract the data" I mean I want the fields in Staff to show the information which is stored in "Qualifications" and "institutions"

RuralGuy
06-08-2007, 04:12 AM
The Evils of Lookup Fields in Tables (http://www.mvps.org/access/lookupfields.htm)

Dennisk
06-08-2007, 04:26 AM
Personally I would ony set up RI for your main data tables not your look up tables.

I've seen dbs where if you delete a row used for lookups all the rows in the main data tables are also deleted. This is very bad design.