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

How to disable "Save message"

P: 14
Hi,

I have this code so it will ask user if they want to save if they click on the "close" button. But some how it also pops up the message when I click on the save button. Is there a way to disable this if user do not click on the "Close" button or if users have already click on the "Save" button first.

Thanks for any idea or help. Michelle

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
Jan 5 '07 #1
Share this Question
Share on Google+
3 Replies


missinglinq
Expert 2.5K+
P: 3,532
Just so you know somebody's listening, Michelle, I copied and pasted your code into a number of forms (single view, continuous, datasheet) and couldn't reproduce your problem. Two questions:

One: You did post all of your code for the sub, didn't you? I only ask because for simplicity's sake people sometime leave out parts they don't think are germaine to the problem and it turns out that it is.

Two: Did you by any chance try this code elsewhere first, like in the AfterUpdate sub, and maybe forget to delete it? I ask this because I placed it in both subs and this will reproduce your problem!
Jan 5 '07 #2

P: 14
I only have the codes in Form_BeforerUpdate sub. I will try to put it Form_AfterUpdate to see if the message still pops up. Michelle
Jan 5 '07 #3

missinglinq
Expert 2.5K+
P: 3,532
You misunderstood, Michelle; having the code in both subs was the only way I could reproduce your problem. It should be only in the BeforeUpdate; makes it easier to undo.
Jan 5 '07 #4

Post your reply

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