Hi,
VFP come with Referential Integrity Builder to help us to do what you mentioned. It allows us to define "action" should be taken if INSERT/UPDATE/DELETE happens to the tables such as cascade for delete (delete all child record if parent record is being deleted).
That is a freeware tool TaxRI in download section which generate better stored procedure code for this purpose.
Note, before this, make sure you have define the relationship between tables in your database.
HTH
I am not the most powerful man in this world.
I am not the worst man in this world either.
I just as same as all of you.
I still need to learn from my mistakes...