Results 1 to 5 of 5
  1. #1
    thefairman is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Location
    California
    Posts
    10

    Don't save when closing form

    I have a form that allows users to enter new data for a database. I have a button on the form to save the record. However, when the form is closed, access saves the record before closing. Is there a way to turn off this function. I want the record to be saved only when pressing the "save record" button. Thanks in advance.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You would need to handle this in the BeforeUpdate event of the form. I would suggest a public flag variable (maybe named SaveOK) that you set true with your Save button before causing the save. Then check the flag in the BeforeUpdate event and do a Me.UnDo if the flag is not set.

  3. #3
    thefairman is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Location
    California
    Posts
    10
    Thanks for your help. I will try that.

  4. #4
    thefairman is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Location
    California
    Posts
    10
    Worked like a charm. Thanks!

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You're more than welcome. Thanks for posting back with your success.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 12-22-2011, 01:12 PM
  2. Closing 1 form and opening another
    By mulefeathers in forum Forms
    Replies: 13
    Last Post: 12-08-2011, 04:04 PM
  3. Replies: 9
    Last Post: 01-20-2011, 02:22 PM
  4. Closing a form through VBA
    By ghostmachine in forum Forms
    Replies: 4
    Last Post: 12-13-2010, 01:57 PM
  5. Don't want to save forms on Refresh or closing
    By accesscoder in forum Forms
    Replies: 5
    Last Post: 09-25-2010, 12:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums