Results 1 to 3 of 3
  1. #1
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149

    Exit button without saving data

    In Form, Textbox's Control Source set to table's field.
    When I close the form, the entered data is saved automatically.
    But, how can I code the Exit button to close the form WITHOUT saving any data?
    Thanks.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Quote Originally Posted by uoghk View Post
    In Form, Textbox's Control Source set to table's field.
    When I close the form, the entered data is saved automatically.
    But, how can I code the Exit button to close the form WITHOUT saving any data?
    Thanks.
    Perhaps something like the following code in the form's BeforeUpdate event.
    Code:
    If Me.Dirty Then    
        If MsgBox("Exit without save?", vbYesNo, "Confirmation Required") = vbYes Then
            Me.Undo
        End If
    End If
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149
    Thanks Bob

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

Similar Threads

  1. Replies: 2
    Last Post: 09-10-2018, 09:08 AM
  2. Replies: 1
    Last Post: 11-17-2016, 10:55 AM
  3. Replies: 3
    Last Post: 04-22-2015, 04:35 AM
  4. Exit forms without saving
    By sk88 in forum Access
    Replies: 19
    Last Post: 12-19-2013, 06:04 PM
  5. Exit without saving Subform
    By sk88 in forum Access
    Replies: 5
    Last Post: 05-03-2012, 11:55 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