How to ensure at least one record in a subform is completed?

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

Guest

Hi,

How do I ensure that at least one record is completed in a subform for every
entry in the main form?

Any help appreciated.

Regards,
Seth
 
Hi,

How do I ensure that at least one record is completed in a subform for every
entry in the main form?

Any help appreciated.

Regards,
Seth

It's not particularly easy, since Access must save the mainform record
as soon as the subform is entered. If it didn't, then it would be much
harder to maintain relational integrity - normally there is a one to
many relationship between the form's recordsource and the subform's,
so there must be a stored mainform record before you can start
entering data into the subform. Therefore, the mainform's BeforeUpdate
event isn't useful in this regard!

I would suggest putting code in the Form's Close event, to do an
"unmatched" query identifying mainform records without child records.
You could even change the mainform's Recordsource to display these
"childless parents" for editing; just don't close the form until these
records have been either fixed or deleted.

John W. Vinson[MVP]
 
Back
Top