Validate datatable (MS Access)

User avatar
ErikJan
BronzeLounger
Posts: 1253
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Validate datatable (MS Access)

Post by ErikJan »

When one wants to couple two tables, one can create a relationship (Relationship tools - Edit Relationships). There is an option "Enforce Relational Integrity" which should normally be enabled to ensure that the relationships are all valid.

If in one of the tables there is an error which prevents this option, it is greyed out. My question is: HOW can we find the place where the error(s) are that cause this???

Imagine a 20K record table with one little error... there must be a way I guess... Anyone who can help me?

User avatar
HansV
Administrator
Posts: 78527
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Validate datatable (MS Access)

Post by HansV »

Make sure that the fields on either side of the relationship are of the same type and size. For example, both fields are number fields, and both are Long Integer. You cannot enforce referential integrity if one field is Long Integer and the other Double.

If there are data in the tables that make enforcing referential integrity impossible, the check box will still be enabled, but if you tick it and click OK, you'll get an error message that Enforce Referential Integrity couldn't be applied.
Best wishes,
Hans

User avatar
ErikJan
BronzeLounger
Posts: 1253
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Validate datatable (MS Access)

Post by ErikJan »

Is is disabled here but even then... if you get the warning you mention that integrity cannot be enabled, the Access KNOWS this. But if I want to fix the problem, I'd like to know WHERE the problems are. Again, as also Access knows, I would think that there should be a way to find that out

User avatar
HansV
Administrator
Posts: 78527
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Validate datatable (MS Access)

Post by HansV »

The first test would be to check the data types and field sizes of the join fields.

Next, you can use the Find Unmatched Query Wizard to find out if there are records on the "many" side of the relationship that do not have a match on the "one" side.
Click Query Wizard on the Create tab of the ribbon to start the Find Unmatched Query Wizard. The instructions should be self-explaining.
Best wishes,
Hans

User avatar
ErikJan
BronzeLounger
Posts: 1253
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Validate datatable (MS Access)

Post by ErikJan »

Thanks, that's what I was looking for