Deleting subform records from a main form

legendv

Registered User.
Local time
Today, 17:13
Joined
Mar 18, 2002
Messages
99
I'm sure this is posted somewhere else and is quite simple, but I haven't ever had to do it. I could use the boards opinions on this.

In the Form Footer of my main form I want to place a cmd that deletes not only the main form record but also the associated subform records that are tied to it.

Any ideas?
 
You need to create a relationship that enforces referential integrity to cascade deletes.
 
Once you have the relationship properly established, deleting the record on the main form will automatically delete the related records in the other table.
 
When you're establishing the relationships with the other tables (the ones being displayed in your subform) just make sure you click on the "cascading deletes" option. When you try and delete the main record, all associated records from other tables (i.e. the ones on your subform) will then be automatically deleted also. You will also be prompted highlighting that this deletion is taking place when you go to delete the main record.
 

Users who are viewing this thread

Back
Top Bottom