Don't save data until submitted?

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

Guest

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?
 
One way to do this would be to have some unbound controls on the main form
and then the code behind the button would insert this data into the relevant
table (or warn the user if there are already 10 records with the current ID)
and then requery the subform. You could prevent users from entering data
into the subform by setting it's allow additions property to no, so that
they have to do it via the boxes on the main form.
An alternate way of doing the same thing would be to have a popup form for
the data entry instead of on the main form, if there are space limitations.
The popupform would have OK and Cancel buttons.
hope this helps
-John
 
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]
 
Back
Top