Stop Second Undo

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rgsw
    New Member
    • Jul 2006
    • 29

    Stop Second Undo

    Hi -

    In a Form in After Update Event I have VBA:
    Code:
     If MsgBox("You have made a change to this record.  Change correct?", vbYesNo, "Change") = vbYes Then
      DoCmd.GoToControl ("ID")
    Else
      DoCmd.RunCommand acCmdUndo
    End If
    End Sub
    This works fine - except that after it 'undo' what you type when you go to the next record the message box comes up again and you have to click yes to continue. I would like to have it stop at the first undo and not have the message box come up again. I know there has to be a way but I sure can't figure it out.

    Thanks!
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by rgsw
    Hi -

    In a Form in After Update Event I have VBA:
    If MsgBox("You have made a change to this record. Change correct?", vbYesNo, "Change") = vbYes Then
    DoCmd.GoToContr ol ("ID")
    Else
    DoCmd.RunComman d acCmdUndo End If End Sub

    This works fine - except that after it 'undo' what you type when you go to the next record the message box comes up again and you have to click yes to continue. I would like to have it stop at the first undo and not have the message box come up again. I know there has to be a way but I sure can't figure it out.

    Thanks!
    Use a before update event, not an after update event. See this link for a detailed "HowTo":

    Comment

    • rgsw
      New Member
      • Jul 2006
      • 29

      #3
      Thanks for your reply and help!

      Comment

      Working...