DONT SAVE WHEN CLOSE OR EXIT FORMS

K

KRISH

Hi!
Kindly help me how to stop save/update records when I close/exit my access
form.
Thanks for any help.
KRISH
 
R

Rainbow01

In Access's default, when you exit form or go to another record, record will
auto saved if edit or add new

From my experience in develop Access Application,
i will make 2 buttons in the form. i.e. SAVE and CANCEL

for SAVE:
Docmd.RunCmd acSaveRecord

for CANCEL:
Me.Undo
Docmd.Close

"KRISH" 來函:
 
A

Allen Browne

If you want to ask the user before any save, use the BeforeUpdate event of
the form:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If MsgBox("Save?", vbOkCancel, "Confirm entry") <> vbOk Then
Cancel = True
'Me.Undo
End If
End Sub

Note that this will trigger regardless of how the save was going to occur.
 
Top