Results 1 to 6 of 6
  1. #1
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 10 Access 2016
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659

    Closing form with code, still saves changes

    The code below is not working for me. I have checked if the record is dirty at the time i click, it returns true. I want to close the form without saving, so that the changes undo.



    Code:
    Private Sub cmdClose_Click()
    Debug.Print Me.Dirty
    DoCmd.Close acForm, Me.Name, acSaveNo
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Then you need to run UNDO command.

    Why would you want to negate user work?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 10 Access 2016
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    Come to think of it, this does seem kinda convoluted.

    Making a change is locked behind some logic, however if you choose to unlock and then edit the document and you didn't mean to. the idea is to undo there, because changes requires documents to be approved.

    I will try undo.

  4. #4
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 10 Access 2016
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    Undo works good thank you!

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Why is user given choice to unlock? Should be prevented if approvals are not done.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    FYI...acSaveNo does not refer to not saving Data...it means not saving changes that have been made to an Object...a Form, in this case!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 1
    Last Post: 06-20-2019, 03:35 PM
  2. Replies: 2
    Last Post: 05-30-2018, 10:43 AM
  3. Run Code on Closing of DB
    By guillermoftw in forum Access
    Replies: 1
    Last Post: 12-16-2014, 11:48 AM
  4. Replies: 1
    Last Post: 07-29-2014, 04:58 PM
  5. Replies: 9
    Last Post: 02-19-2010, 12:07 PM

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