deleting a record only if no child records exist

M

Meryl

I have a donor database where the donor table houses the
address information about the donor and the donations
table stores the individual donations for that donor.
It's a 1 to many relationship.

Sometimes a donor moves and we can't get their new
address. If they haven't made any donations, I want to be
able to delete the donor record.

How can I test if any child (donations) records exist for
a donor before deleting?

Thanks!
 
D

Douglas J. Steele

Create a relationship between the two tables, and check to enforce
referential integrity. Make sure you haven't got the Cascade Delete Related
Records box checked. Now, if you try to delete a record and there are
children records, Access will raise an error.
 

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