Don't delete the children

G

Guest

Hello,

How do you stop the deletion of the parent if and only if
there are children? I could do a record could of the
children but is there an easier way? Thanks as always
for your assistance.

David S.
 
J

John Vinson

Hello,

How do you stop the deletion of the parent if and only if
there are children? I could do a record could of the
children but is there an easier way? Thanks as always
for your assistance.

If you have a Relationship between the parent table and the child
table, and check Enforce Relational Integrity - and DO NOT check
Cascade Deletes - you will be prevented from deleting a parent record
if that deletion would leave "orphan" children.


John W. Vinson[MVP]
(no longer chatting for now)
 
D

Dan Artuso

Hi,
Enforce referential integrity.
Open up the Relatioships ...
Add the tables and link the relevant fields by dragging
one field to the other.
When the dialog box pops up, check off
"Enforce referential integrity"

Now Access will not let you orphan any child records.
 
G

Guest

Excellent! Thank you.
D
-----Original Message-----


If you have a Relationship between the parent table and the child
table, and check Enforce Relational Integrity - and DO NOT check
Cascade Deletes - you will be prevented from deleting a parent record
if that deletion would leave "orphan" children.


John W. Vinson[MVP]
(no longer chatting for now)
.
 

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