Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Jul 2001
    Location
    New Zealand
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question from 'novice' regarding subforms (Access 97)

    I hope that someone can help me with this question, please. Ive checked back through a number of logs on this matter, and am still confused. The manuals (ha!) are not at all helpful (surprise!).

    I have just changed an application for a client, and due to the number of fields being accessed from a number of table, have had to use subforms. [I have never used subforms before (there has never been the need to use them), and have noticed some 'interesting' anomalies with them.]

    The application allows the user to modify information within a number of logically linked tables. When the application was running with all information retrieved using a query there were no apparent problems - there was a Save button, as well as a Cancel/Quit button. Pressing the former would write the updated info to the various tables; the latter would tell the app to forget any changes.

    However, it appears that if a user changes data within a subform that is linked to one of the tables, then exits from this subform back to the main form, the system appeas to be saving this data into the database. Logically, then, if the user selects the Quit button on the main form, all changes to the main form are dropped, but the changes made to the data in the subform are still changed.

    Am I incorrect in this assumption; and importantly, if not, how can I prevent this from happening? There does not appear to be a 'roll-back' facility in Access that would allow me to checkpoint and roll-back any updates from this user.

    Many thanks for your assistance.

    Regards

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Question from 'novice' regarding subforms (Access 97)

    You can't prevent it from happening. When you exit the subform, it will save the record automatically unless you cancel the edit. The same is true when you move from the parent form to the subform, the parent record gets saved. The relationship has to work that way or you would be trying to create child records before the parent record was saved, which shouldn't be possible in a properly designed database anyhow. If you want an "undo" capability, you'll have to program it based on something you can test for and then delete the related records before writing the old data back to the parent record or deleting the parent record as well if that is what is required. The built-in undo only applies to the current record, that is, the record that has not yet been saved. That record is also the current record in whichever form or subform has the focus, not in all of them at once.
    Charlotte

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Question from 'novice' regarding subforms (Access 97)

    DAO provides a rollback facility. I haven't used it in the exact circumstances you describe.
    Help in Access 97 has a fair bit about it, and a few examples
    Regards
    John



  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Question from 'novice' regarding subforms (Access 97)

    Only inside transactions, John. It still won't work between a parent and child form, at least not in Access 97.
    Charlotte

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Question from 'novice' regarding subforms (Access 97)

    As Charlotte pointed out, this behavior is automatic.

    Microsoft has an example of how to undo changes in a main form *and* sub form in the Sample Forms database downloadable from ACC97: Microsoft Access 97 Sample Forms Available in Download Center.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •