Autosave Access Forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sarah2855
    New Member
    • May 2010
    • 21

    Autosave Access Forms

    How can I disable auto save function in access forms?Currently , If accidentally something is changed in forms, it gets saved automatically without being prompted.

    Thanks in advance
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    You could add code to the forms Before_Update event. Something to ask the user if they want to save changes to the form and based on a yes/no answer either save or undo those changes.

    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Dim rslt As Integer
    
        If Me.Dirty Then
            rslt = MsgBox("Do you want to save the changes you have made to the form", vbYesNo)
            If rslt = vbNo Then ' if the user didn't mean to make changes
                Me.Undo
            End If
        End If
        
    End Sub

    Comment

    • sarah2855
      New Member
      • May 2010
      • 21

      #3
      Originally posted by msquared
      You could add code to the forms Before_Update event. Something to ask the user if they want to save changes to the form and based on a yes/no answer either save or undo those changes.

      Code:
      Private Sub Form_BeforeUpdate(Cancel As Integer)
      Dim rslt As Integer
      
          If Me.Dirty Then
              rslt = MsgBox("Do you want to save the changes you have made to the form", vbYesNo)
              If rslt = vbNo Then ' if the user didn't mean to make changes
                  Me.Undo
              End If
          End If
          
      End Sub
      Thanks msquared, That resolved my problem.

      Comment

      Working...