Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2003
    Location
    Canton, Ohio, USA
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Editing a form (2000)

    I have a form that is filled out from information in the database. The form is meant to be an edit form to change parts of the information or correct it. Once the information is editted, it now automaticly updates the database. Is there a way to cancel the change if the user makes a mistake? I'm using a button but can't set it to close the form without saving the changed information or putting it back the way it was before the edit. Is it a "DoCmd"?

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

    Re: Editing a form (2000)

    You can use the BeforeUpdate event of the form to check whether the record about to be saved meets all requirements. If it doesn't, set Cancel to True (Cancel is an argument of the BeforeUpdate event handler.)

    In general, you can use Me.Undo to undo the changes made to the current record.

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

    Re: Editing a form (2000)

    Can you define a "mistake"? Unless it is something the computer can determine for itself, you will have to rely on the user to tell you that the information is correct. The record is saved automatically in the AfterUpdate event of the form, which will happen when you close the form unless you cancel the update in the Form's BeforeUpdate event. You could put a test or a confirmation message into the BeforeUpdate event of the Form and have either the application or the user confirm that everything is correct.
    Charlotte

Posting Permissions

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