Forms and data entry

  • Thread starter Thread starter Nhu
  • Start date Start date
N

Nhu

I have several forms set up for data entry into various
tables. I've created the forms to have a save button that
runs several things behind the scenes.

In any case, what I've noticed is that any information in
the fields of the form are put right into the table that
it's connected to regardless of whether the save button is
clicked or not.

How do I lock the form (or table) so that no data is
transferred until the form is exited properly?

Thanks to anyone who can help me out.

-Nhu
 
Nhu said:
I have several forms set up for data entry into various
tables. I've created the forms to have a save button that
runs several things behind the scenes.

In any case, what I've noticed is that any information in
the fields of the form are put right into the table that
it's connected to regardless of whether the save button is
clicked or not.

How do I lock the form (or table) so that no data is
transferred until the form is exited properly?

Thanks to anyone who can help me out.

The normal, designed behavior for Access is to save data entered in
bound forms automatically when you either close the form or move to a
new record on it. There is no need for an explicit save. Most users
prefer this method, as it takes fewer steps to do data entry.

If you really want to circumvent this behavior, you can (a) use an
unbound form, and supply your own code to insert data from the form
controls into the appropriate table, (b) use a bound form but with
unbound controls, and supply your own code to transfer data from the
fields of the form's recordset to the controls and back again, or (c)
use a module-level flag variable that is checked in the form's
BeforeUpdate event to see whether the update should be permitted or not.
To expand on that last approach, your "save" button would set the flag
variable, then issue one of several possible VBA statements to force the
record to be saved. In the form's AfterUpdate event, the flag variable
would be reset.
 
Back
Top