Hi,
I think the problem is that the 'Trigger' is activated 'after' the deletion of the parent record. This causes the child records to loose the link to the parent table (orphans).
You might try using referential integrity with a cascade delete on the parent to child relation so it will delete the child records too once the parent record is deleted.
HTH,
Arriyel
>Hi all,
>
>I encounterd a something I have not seen before Friday: A self referencing relation (I think that is the term). A single table contains both "parent" and "child" records. The rule is when the parent (the prime) is deleted the children (the sub) are also deleted. However, VFP generates the 1887 error when the parent is deleted. (NOTE: the actual error displayed is Trigger Failed, but tracing down the failure I found the 1887 error was the root cause.)
>
>Both the parent and the child contain the some data. The child records contain a field that refers back the to parent (in the parent this field is zero) primary key value.
>
>My problem: implementing the trigger to delete the "child" record when the "parent" is deleted. Has anyone encountered this type of structure and successfully built a trigger to perform this action?
>
>I'm using VFP6 SP5. Changing the data structure at this point is not an option -- the client is adamant about keeping it as is.
>
>TIA
>
>Robert
Speak using soft and sweet words in case you have to eat them later.