How to turn off autosave?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    How to turn off autosave?

    I'm trying to make it so that if I leave a record without saving it, the changes aren't saved. A message asking if you want to save the changes would be nice. I just don't want someone to accidentally make a change and then go onto the next record and the information is saved. From what I have been reading online, I'm guessing that I need something in the BeforeUpdate event, but I don't know what. I'm using Access 2010.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Something alone these lines should work:
    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Dim strMsg As String
    Dim intResponse As Integer
    
    strMsg = "You have made one or more changes to this Record. Do you wish to Save this Record " & _
             "with those changes?" & vbCrLf & vbCrLf & "Click Yes to Save changes, or Cancel to " & _
             "UNDO these changes?"
             
    intResponse = MsgBox(strMsg, vbQuestion + vbOKCancel + vbDefaultButton1, "Promopt to Save Record")
    
    If intResponse = vbCancel Then
      DoCmd.RunCommand acCmdUndo
    End If
    End Sub

    Comment

    • Seth Schrock
      Recognized Expert Specialist
      • Dec 2010
      • 2965

      #3
      Will this make it so that for each field you will have to hit yes, or when you try to leave the current record all fields will be saved or not?

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        For the Current Record.

        Comment

        • Seth Schrock
          Recognized Expert Specialist
          • Dec 2010
          • 2965

          #5
          Thank-you so much. I will try it when I get to work tomorrow and see what I get.

          Comment

          • Seth Schrock
            Recognized Expert Specialist
            • Dec 2010
            • 2965

            #6
            It worked perfectly. Thank-you so much.

            Comment

            • ADezii
              Recognized Expert Expert
              • Apr 2006
              • 8834

              #7
              You are quite welcome.

              Comment

              Working...