I have a form with a continuous subform. A record must be added via the main
form and then up to ten records can be added via the subform.
I'd like to force the user to press a submit button to confirm saving the
data, so they will have a chance to review all data before actually saving it
to the database.
How can I accomplish this?
Only with considerable difficulty. Because of the way subforms work,
the mainform record is saved to disk the instant you start to enter a
record in the subform; this is essential, in order to preserve
relational integrity (you can't enter a child record unless a parent
record exists). Similarly, each subform record is saved when you move
to the next record.
You've got two rather disagreeable choices:
- Set up the relationship between the tables to Cascade Deletes, and
provide a "Cancel" button on the mainform which actually runs a Delete
query to delete the currently displayed mainform record (and, via the
cascade deletes, all of the related child records). This is sort of
the "negative option" of your Submit button.
- If you really want to ensure that NO data reaches the tables until
the Submit button is pressed, you need to bind the form to two
additional tables - temporary scratchpads. The Submit button would
then run two Append queries to migrate the data from the bound tables
into the "real" tables, and then run Delete queries to empty the
scratchpads for the next order. This makes editing existing records
vastly more complex (in fact you'ld probably want separate forms for
data entry and for editing).
John W. Vinson[MVP]