Undo command

B

Bumbino

I have a form with an embedded subform. I have a cancel command button that
when pressed performs Me.Undo. I want it to also undo the entires in the
subform but cannot get it to work. Any help?
 
J

John Spencer

If the button is on the main form, it is too late to UNDO changes in the
subform.

If you want to undo all changes to the main form and its subform(s), then
ONE solution is to use temporary work tables.
You must copy the current set of information from the "permanent" tables
into the temporary work tables, make changes (edits/adds/deletes) to records
in the work tables and when you are finished use the temporary work tables
to update the "permanent" tables.

If you want to UNDO the changes, then you simply discard the information in
the work tables. Otherwise, you will have to use logic to append, delete,
and update the main tables. This is not a simple task, but can be done.

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
B

Bumbino

Thanks John. A temp table it is.

John Spencer said:
If the button is on the main form, it is too late to UNDO changes in the
subform.

If you want to undo all changes to the main form and its subform(s), then
ONE solution is to use temporary work tables.
You must copy the current set of information from the "permanent" tables
into the temporary work tables, make changes (edits/adds/deletes) to records
in the work tables and when you are finished use the temporary work tables
to update the "permanent" tables.

If you want to UNDO the changes, then you simply discard the information in
the work tables. Otherwise, you will have to use logic to append, delete,
and update the main tables. This is not a simple task, but can be done.

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top