Stop save when close or new button

MAAS8000

Registered User.
Local time
Today, 13:56
Joined
Apr 3, 2018
Messages
38
access by default save all records immediately
In the entry form the access save the entry always on closing or pressing new,
I need saving to be after pressing save only
 
Why? It's harder. Why do it the harder way? If you don't want the record, just delete it. Also, you can undo the creation of a new record if you hit ctrl + z.
hth
Mark
 
There is a thread similar of what you have. The solution is transated form. Go and search for it.
 
There is a thread similar of what you have. The solution is transated form. Go and search for it.
if you could help me , I will be thankful.
I have two problem in the previous, and after search I solved one but this NO
thank you:):)

the problem in other words, I don't want access to save record from the entry form until the user press save. to avoid unintended saving when close or new.
 
if you could help me , I will be thankful.
I have two problem in the previous, and after search I solved one but this NO
thank you:):)

the problem in other words, I don't want access to save record from the entry form until the user press save. to avoid unintended saving when close or new.
you could use the form's Before Update event to catch attempt to save the record and then cancel the update if the record should not be saved.
 
I have tried this but not working in the close button . it also make saving

Private Sub Command12_Click()
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
 
As I said in my previous post, you need code in the form's Before Update event which would cancel the update if validation fails
 
Last edited:
Here's some boilerplate code I ran up years ago, using the approach already suggested, here:

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)

If Not (Me.NewRecord) Then
  If MsgBox("Would You Like To Save The Changes To This Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save Changes to Record ???") = vbNo Then
   Me.Undo
  End If
Else
  If MsgBox("Would You Like To Save This New Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save This New Record ???") = vbNo Then
   Me.Undo
  End If
End If

End Sub
Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom