Saving Data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way to disable the automatic saving function. I have a database
where i would like the user to have the ability to back out of changes if a
mistake has been made but I have noticed that when you enter that
information, it will automatically save it to the tables when I close the
form or the entire database.

Thanks in advance.

Tom
 
Is there any way to disable the automatic saving function. I have a database
where i would like the user to have the ability to back out of changes if a
mistake has been made but I have noticed that when you enter that
information, it will automatically save it to the tables when I close the
form or the entire database.

Thanks in advance.

Tom

Two Escape key hits will do it or you can put Me.UnDo under an Oops key or catch
it in the BeforeUpdate event of the form and ask the user if saving is ok.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
Tom:

Here's the code for a module of a form which prompts the user before a
record is saved, and also forces the user to use a custom cmdClose button on
the form to close it. It’s the code in the form's BeforeUpdate function
which prevents the record being saved if user does not confirm.

Option Compare Database
Option Explicit

Dim blnCloseMe As Boolean

Private Sub cmdClose_Click()

' set value of module level variable
' to true when custom close button clicked,
' thus enforcing closure only via this button
blnCloseMe = True
DoCmd.Close acForm, Me.Name

End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)

' get user confirmation of whether to save record or not
If MsgBox("Save Record?", vbQuestion + vbYesNo) = vbNo Then
Cancel = True
Me.Undo
End If

End Sub


Private Sub Form_Error(DataErr As Integer, Response As Integer)

' trap and ignore data error if
' user attempts to close form
' and abandon an edit other than via
' the custom close button
If DataErr = 2169 Then
Response = acDataErrContinue
End If

End Sub


Private Sub Form_Unload(Cancel As Integer)

' prevent closure of form other than
' by custom close button
Cancel = (blnCloseMe = False)

End Sub

Ken Sheridan
Stafford, England
 
Thank you very much eveyone. Me.Undo works like a charm.

Thanks again

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top