locked
Undo on a Form with SubForms RRS feed

  • Question

  • Hi All,

    I have a Form with three (3) subforms in Datasheet View.  When I click Cancel on the Form, I would like to undo whatever was done on the form and the subforms before closing the form.  If it possible to undo changes to so many forms at once?

    Cheers


    Stephen, RedGalaxy Darwin, Australia

    Sunday, February 24, 2013 2:13 AM

Answers

  • Hello,

    It is not easy, but not impossible.

    You can create temp tables that feed your forms - then any changes would not affect your working tables if you click Cancel. To submit the changes - create and run update+append+delete queries to update working tables from the temps..

    Another solution - create copies of your working tables and if Cancel button had been used -  run updates on your working tables from the copies.

    Nadia

    • Marked as answer by RedGalaxy Tuesday, February 26, 2013 1:17 AM
    Sunday, February 24, 2013 9:48 PM

All replies

  • Not really. As soon as focus moves from the record on the parent form to one of the subforms, the parent record is saved. And each time you move from one subform to another, the current record on the subform from which you've come is saved. Since it's saved, there's no mechanism to "unsave" it.

    Doug Steele, Microsoft Access MVP
    http://www.AccessMVP.com/djsteele (no e-mails, please!)
    Co-author Access Solutions — Tips, Tricks, and Secrets from Microsoft Access MVPs (ISBN 978-0-470-59168-0)

    Sunday, February 24, 2013 2:27 AM
  • Hello,

    It is not easy, but not impossible.

    You can create temp tables that feed your forms - then any changes would not affect your working tables if you click Cancel. To submit the changes - create and run update+append+delete queries to update working tables from the temps..

    Another solution - create copies of your working tables and if Cancel button had been used -  run updates on your working tables from the copies.

    Nadia

    • Marked as answer by RedGalaxy Tuesday, February 26, 2013 1:17 AM
    Sunday, February 24, 2013 9:48 PM
  • Not quite the simple solution that I was looking for Nadia, but effective. It also allows for what is essentially a transaction rollback sequence.  Thanks.

    Stephen, RedGalaxy Darwin, Australia

    Tuesday, February 26, 2013 1:18 AM
  • Hello Nadia, would you have an example on how to do your first solution of create temp tables and create and run update+append+delete......?
    • Edited by nelson73 Sunday, January 3, 2021 5:31 PM
    Sunday, January 3, 2021 5:28 PM
  • Why not create an audit log and then revert as required?

    The other option is to use unbound forms.


    Daniel Pineault, 2010-2019 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    Sunday, January 3, 2021 10:28 PM