By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,153 Members | 2,581 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,153 IT Pros & Developers. It's quick & easy.

No Save message display when closing the form

P: 14
Hi.
When I create a new record, if I click on close, the window just close and no message appears asking if I want to save this record. Is there a way to force a message appear if user close the form? Thanks for any help. Michelle
Dec 14 '06 #1
Share this Question
Share on Google+
4 Replies


MSeda
Expert 100+
P: 159
you can put the following code in the before update event for your form.


Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim result As Integer

result = MsgBox("Do You Want to Save the Changes?", vbYesNo)

If result = 7 Then
Me.Form.Undo
End If


End Sub
Dec 14 '06 #2

P: 14
Thanks. It works. Mchelle
Dec 14 '06 #3

NeoPa
Expert Mod 15k+
P: 31,616
Go to Tools / Options / Edit/Find / Confirm to see what you want to choose confirmations for.
These can be disabled and reenabled in VBA using
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.SetWarnings(False)
  2. and
  3. Call DoCmd.SetWarnings(True)
Dec 14 '06 #4

MSeda
Expert 100+
P: 159
your very welcome
Dec 14 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.