Saving data only when "save button" is pressed

  • Thread starter Thread starter CJA
  • Start date Start date
C

CJA

Hello!

In a "invoice layout" i have a main form with some details and buttons
(last, next, save, etc) and a subform with products details.

When i change something, it will automatically be changed in the database,
even if i do not press a "save button".

What i want is save all the changes made, like new product price or quantity
or even new product line in the subform, only when i press the save button
and if i close the form without saving, all the changes are lost and i get
the last saved information.

Thanks for helping!!

CJA
 
Access saves each record individually. It has to save the main form record
before you can create related records in the subform. There are dozens of
things that trigger the record save, e.g. moving record, moving into the
subform, applying a filter, changing the sort order, closing the form,
closing Access, pressing Shift+Enter, saving through the menus, code,
requerying, and so on.

If you want to avoid writing to the table until both the main form and
subform records are updated and a Post button is clicked, you will need to
create a couple of temporary tables and add the data there. Once you have
checked it all out, you can then execute a pair of append query statements
to add the record to your real table.

That works okay for adding new records, but it is not quite so simple for
editing, where you must copy the record to the temp tables, edit it there,
and execute Update queries instead of Append queries, checking if any other
users have also been editing the same records at the same time since you
copied them to your temp tables.
 
Back
Top