unmatched record query question

  • Thread starter Slez via AccessMonster.com
  • Start date
S

Slez via AccessMonster.com

A while back, I had a corruption issue, and without me realizing it, the one-
to-many relationship between related tables was deleted. Now, when I try to
reset the relationships I get an error message that states that record(s)
violate referential integrity rules. I suspect that one or more records in
the parent table may have been deleted, but the related record(s) in the
child table still exist.

My tables are structured as follows:
The parent table "Bid" has 2 primary key fields - ProjectID, BidID
The child table "Item" has 4 primary key fields - ProjectID, BidID,
RoomNumber, ItemNumber
The table "Bid" is on the "one" side of the "one-to-many" relationship.

When I run an Unmatched Record Query, which when running the wizard only
allows you to base it on one field in each table, I don't get any records
returned. How can I modify the query so that it returns what combinations of
ProjectID / BidID exist in the Item table but not in the Bid table.

Any help is appreciated! Thanks!
 
K

KARL DEWEY

Try this ---
SELECT Item.ProjectID, Item.BidID
FROM Item LEFT JOIN Bid ON (Item.BidID = Bid.BidID) AND (Item.ProjectID =
Bid.ProjectID)
WHERE (((Bid.ProjectID) Is Null) AND ((Bid.BidID) Is Null));
 
S

Slez via AccessMonster.com

Karl,
That worked perfectly! Thank you so much for the help!
Another shining example of how this great this forum is!
Slez

KARL said:
Try this ---
SELECT Item.ProjectID, Item.BidID
FROM Item LEFT JOIN Bid ON (Item.BidID = Bid.BidID) AND (Item.ProjectID =
Bid.ProjectID)
WHERE (((Bid.ProjectID) Is Null) AND ((Bid.BidID) Is Null));
A while back, I had a corruption issue, and without me realizing it, the one-
to-many relationship between related tables was deleted. Now, when I try to
[quoted text clipped - 15 lines]
Any help is appreciated! Thanks!
 

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