Referential Integrity

  • Thread starter Thread starter Pete W
  • Start date Start date
P

Pete W

I am trying to establish referential integrity between two
tables. I linked them by IDnumber. Facility Information
is the primary table and IDnumber is the primary key. The
communication table is the secondary table. It should be
a one to many relationship. When I try I get an error
message 'data in the table "communication" violates
referential integrity rules'. Some facilities have no
communications yet and therefore on entries in the
communications table. Is this causing the problem???

Thanks
 
I am trying to establish referential integrity between two
tables. I linked them by IDnumber. Facility Information
is the primary table and IDnumber is the primary key. The
communication table is the secondary table. It should be
a one to many relationship. When I try I get an error
message 'data in the table "communication" violates
referential integrity rules'. Some facilities have no
communications yet and therefore on entries in the
communications table. Is this causing the problem???

Possibly; if the foreign key field in Communications is zero and there
is no IDNumber 0 in the main table you'll get this message.
Annoyingly, Access sets 0 as the default value for Number fields even
if (as in this case) you want undefined values to be NULL; you must
manually change the Default property of the field.

If that's not the case, then there must be at least one record in the
Communication table with an ID number which does not exist. You can
use the Unmatched Query Wizard to find it; once it's fixed you should
be able to establish RI.
 
Back
Top