469,282 Members | 2,000 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

How to turn off autosave?

Seth Schrock
2,962 Expert 2GB
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.
Jan 25 '11 #1

✓ answered by ADezii

Something alone these lines should work:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2. Dim strMsg As String
  3. Dim intResponse As Integer
  4.  
  5. strMsg = "You have made one or more changes to this Record. Do you wish to Save this Record " & _
  6.          "with those changes?" & vbCrLf & vbCrLf & "Click Yes to Save changes, or Cancel to " & _
  7.          "UNDO these changes?"
  8.  
  9. intResponse = MsgBox(strMsg, vbQuestion + vbOKCancel + vbDefaultButton1, "Promopt to Save Record")
  10.  
  11. If intResponse = vbCancel Then
  12.   DoCmd.RunCommand acCmdUndo
  13. End If
  14. End Sub

6 7537
ADezii
8,800 Expert 8TB
Something alone these lines should work:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2. Dim strMsg As String
  3. Dim intResponse As Integer
  4.  
  5. strMsg = "You have made one or more changes to this Record. Do you wish to Save this Record " & _
  6.          "with those changes?" & vbCrLf & vbCrLf & "Click Yes to Save changes, or Cancel to " & _
  7.          "UNDO these changes?"
  8.  
  9. intResponse = MsgBox(strMsg, vbQuestion + vbOKCancel + vbDefaultButton1, "Promopt to Save Record")
  10.  
  11. If intResponse = vbCancel Then
  12.   DoCmd.RunCommand acCmdUndo
  13. End If
  14. End Sub
Jan 30 '11 #2
Seth Schrock
2,962 Expert 2GB
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?
Jan 30 '11 #3
ADezii
8,800 Expert 8TB
For the Current Record.
Jan 30 '11 #4
Seth Schrock
2,962 Expert 2GB
Thank-you so much. I will try it when I get to work tomorrow and see what I get.
Jan 30 '11 #5
Seth Schrock
2,962 Expert 2GB
It worked perfectly. Thank-you so much.
Jan 31 '11 #6
ADezii
8,800 Expert 8TB
You are quite welcome.
Jan 31 '11 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by p-nut | last post: by
3 posts views Thread by ilushn | last post: by
7 posts views Thread by jaYPee | last post: by
2 posts views Thread by Groove | last post: by
3 posts views Thread by John Wright | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.