Link to home
Start Free TrialLog in
Avatar of Patrick O'Dea
Patrick O'DeaFlag for Ireland

asked on

Access VBA Simple "undo" question

See my VBA which does a msgbox "beforeupdate".
Question: If I click "cancel" in the msgbox WHY does it NOT undo the change I made to the control IFGYesNocmb.  Do I need to do some thing else??

Private Sub IFGYesNocmb_BeforeUpdate(Cancel As Integer)
If MsgBox("Confirm This Change to IFG Status", vbOKCancel, _
    "OK Or Cancel") <> vbOK Then
    Me.IFGYesNocmb.Undo
    Exit Sub
End If

End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No points please.

I think you can remove the UNDO line and simply use Scott's line:

If MsgBox("Confirm This Change to IFG Status", vbOKCancel, _
    "OK Or Cancel") <> vbOK Then
    Cancel = True
End If
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Patrick O'Dea

ASKER

folks, I tried the "Cancel=True" but no joy.
See attached frmMain.   Perhaps because it is a "combo" or perhaps the continuous form causes a complication.

See 20 second video
http://screencast.com/t/lii9Pl7LDwyT
IFG1.accdb
Thanks Pat,

That's it!
I don't quite follow. Seems my code was the solution, with Pat's explanation being followup, so I'm not clear on the point award. Can you please explain why you awarded points in that manner?
Sorry Scott , I mis read the comments.

How can I re-allocate points?
You can ask the Mods to reopen the question. Just use the Request Attention link at the top of your question, just below the original text.
Thanks,
All working well.