Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

not saving a record 2

Status
Not open for further replies.

jgoodman00

Programmer
Jan 23, 2001
1,510
I have just started a form for which the client requires a save button. This is simple enough. However, the reason they want a save button, is because they do not want changed (or indeed added) data to be stored until they click the save record button. Therefore, does anyone know of a way to disable this part of access. i.e. the part which automatically updates the records within the tables as you change them in a form.

James Goodman
j.goodman00@btinternet.com
 
Use the form's BeforeUpdate event to run code each time Access tries to save a record. This way, if the user doesn't want to save a record, you can issue an Undo command instead of saving the record.


Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
strMsg = "Data has changed."
strMsg = strMsg & "@Do you wish to save the changes?"
strMsg = strMsg & "@Click Yes to Save or No to Discard changes."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes Then
'do nothing
Else
DoCmd.RunCommand acCmdUndo
End If
End Sub


Hope this helps
Bernadette X-)
 
A simple Me.Undo will also do the trick.

Steve King
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top