Close Without Save

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • toddw607
    New Member
    • Feb 2007
    • 41

    #1

    Close Without Save

    I have a form with 6 subforms in Access 2003 with two command buttons at the bottom of the form. When I add data into 2 of the forms and click "Exit with No Save" these two forms retain their data. However, one of the subforms is entirely comprised of Check boxes and when I open an existing record and click on any of the boxes the main form closes but retains the data of only the first one selected. The other subform has an attachment command button and always saves when clicked on "Exit with No Save". Maybe the reason is geared towards the entry screens in question being subforms. Any ideas?
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Naming a button Exit Without Save doesn't do anything unless you have code behind it. You'll need to either delete the record or undo the changes.

    Comment

    • toddw607
      New Member
      • Feb 2007
      • 41

      #3
      Originally posted by Rabbit
      Naming a button Exit Without Save doesn't do anything unless you have code behind it. You'll need to either delete the record or undo the changes.
      This is all my close without save command button has in it:
      Code:
          Private Sub cmdCloseNoSave_Click()
          DoCmd.Hourglass True
              Select Case MsgBox("You are about to close the form without saving your changes.  Are you sure you want to do this?", vbExclamation + vbYesNo, "Close without Saving")
              Case vbYes
                  Me.Undo
                  Me.Dirty = False
                  DoCmd.Close
              Case vbNo
              
              End Select
          DoCmd.Hourglass False
      End Sub
      Why do you think it would be saving?
      Last edited by NeoPa; Mar 1 '07, 02:07 PM. Reason: Tags

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Maybe you need to execute the Undo on the main form as well as all the subforms.

        Comment

        • toddw607
          New Member
          • Feb 2007
          • 41

          #5
          Originally posted by NeoPa
          Maybe you need to execute the Undo on the main form as well as all the subforms.
          I will try that, thank you!

          Comment

          Working...