Referential Integrity

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
 
J

John Vinson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top