Delete Children

rhernand

Registered User.
Local time
Today, 03:41
Joined
Mar 28, 2003
Messages
96
I have a Form that I use to view records from a Main Table. The records have an Autonumber. I also have a Remarks Table that contains remarks for each record in the Main Table. The records in the Remarks table records also have an Autonumber for each remark and save the Autonumber for the Main record. On the Form I have a Delete command button. How can I delete the Remarks children records at the same time
 
In Menu->Tools->Relationships you can enforce referential integrity in the relationship between the two tables, and specify cascade delete as an attribute of that relationship. Then when the parent record is deleted, the DBEngine deletes the child.

If you can't enforce RI, you must delete the child manually using something like...
Code:
CurrentDB.Execute "DELETE FROM ChildTable WHERE MainTableForeignKey = " & MainTableID
 
RI Worked Great thanks

RI Worked Great

thanks
 

Users who are viewing this thread

Back
Top Bottom