Form and Subform Data Entry

  • Thread starter Thread starter Vincent
  • Start date Start date
V

Vincent

Hi,

I have two related tables linked by and InvoiceID as the
primary key for one table and a foreign key for the other
table.

I have made a form and subform. I set both keys to be
required.

My PROBLEM is I noticed that users can fill in all
required fields for the first Main form but can choose to
close the application and allows it to save information on
main form.....

How can I make it so that the Main form ONLY saves if the
requirments in the Subform (Required fields) are all
filled?

Currently it allows a record to be saved with no subform
detail, thus useless record. Please help I suck at VBA.

Thanks!!!!!
 
Vincent, there is not a simple solution to your question.

It's a chicken and egg situation: you cannot create the subform record until
the main form record is saved, and therefore you cannot require that the
subform record exists before you allow the main record to be saved.

If it is absolutely essential, then it may be worth creating a pair of temp
tables to hold the new records, and then check them before writing them to
the main invoice table. That's a fair bit of work, and has other drawbacks.
 
Back
Top