DONT SAVE WHEN CLOSE OR EXIT FORMS

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

Guest

Hi!
Kindly help me how to stop save/update records when I close/exit my access
form.
Thanks for any help.
KRISH
 
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" 來函:
 
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.
 

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

Back
Top