a very simple question about msgbox

mkkashif

Registered User.
Local time
Today, 13:35
Joined
Sep 1, 2004
Messages
88
i am using vbyesnocancel msgbox.
what i have to do if user click on cancel.nothing done return to form.
the code i am using undo the record.if press cancel.

i want if user click on yes then go to new record.
if user click on no undo the record
if user click on cancel return to form.

code
If MsgBox("ok good bye", vbYesNoCancel, "Save Record?") = vbYes Then
DoCmd.GoToRecord , , acNewRec
Else
DoCmd.RunCommand acCmdUndo
End If
 
i am using this code but on press cancel Undo the Record
i don't want Undo when press the cancel button.
what is wrong in my code



If MsgBox("ok good bye", vbYesNoCancel, "Save Record?") = vbYes Then
DoCmd.GoToRecord , , acNewRec
ElseIf vbNo Then

DoCmd.RunCommand acCmdUndo
Else

End If
 
Try this code below

Dim strMsg As String, strTitle As String

strMsg = "Do You Want To Save This Record?"
strTitle = " Save Record ?"

If MsgBox(strMsg, vbQuestion + vbYesNo, strTitle) = vbNo Then
Me.Undo

End If


hth,

Michael
 

Users who are viewing this thread

Back
Top Bottom