View Full Version : Parent-Child Cascading Deletes


Harry Shmedlap
11-04-2007, 01:55 AM
I have a simple Family table:

PersonID
Name
ParentID

where, in the case of a child, its ParentID contains the PersonID of its parent.
In the Relataionships window I put two such tables, Family and Family_1 and I joined Family.ParentID to Family_1.PersonID. I set referential integrity, cascading updates and cascade deletes.
I made a Parents form (by setting the ParentID criteria to Is Null), and added a Children subform (linking the ParentID of the subform to the PersonID of the main form).

The cascading updates works when I add a new child but when I try to delete a parent I get the error: Could not update; currently locked.
Why doesn't the cascade delete work?

Premy
11-04-2007, 01:13 PM
Check out: http://allenbrowne.com/ser-06.html

HTH

Premy

Harry Shmedlap
11-05-2007, 06:57 AM
Thanks for the link but it didn't answer my question.
What do I do to stop the error and to allow me to delete a parent and all its children?

The_Doc_Man
11-05-2007, 10:47 AM
If a query is used in the parent and a different query is used in the child form, and both use the same table or JOIN on the same table, that is a self-lock. The parent is blocking the update OR the child is blocking the update depending on where you try the delete.

I didn't check the link, but this is a common situation so I thought I'd stab at it.