Main Form and SubForm - deletions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a Main Form with a SubForm for data entry.

It seems that to delete the records on a current input, I need to delete the
records in the Sub Form - and then separately delete the records in the
Main Form.

Is there any way that I can delete all the records in both forms
similtaneously.
 
What is the relationship between the main form's records and the subform's
records?

If they come from the same table, you could delete from one form and the
Requery the other. (There seems to be lots of questions from people who put
the same table in the main form and subform, but it is a really bad way to
build an interface in Access. It will give you concurrency problems, and can
even corrupt the AutoNumber preventing you from adding any new records at
all.)

If the subform contains related records from another table (and that is the
right way to use a subform), you can set up your relationship between the
tables so that when you delete a main form record, it automatically deletes
the subform record. To do that, open the Relationships window (Tools menu),
and make sure you have created a relationship between the 2 tables.
Double-click the line joining them, and make sure the Referential Integrity
box is checked. Then check the Cascading Delete box as well. When you delete
a main form record, all the related records in the subform will be deleted
as well.
 
Back
Top