# MS Access - Cancel the Before Update event

**URL:** <https://boards.straightdope.com/t/ms-access-cancel-the-before-update-event/340511>\
**Category:** Factual Questions\
**Created:** [January 18, 2006, 2:53pm UTC](https://boards.straightdope.com/t/ms-access-cancel-the-before-update-event/340511 "2006-01-18T14:53:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zoid/32/336_2.png) [@zoid](https://boards.straightdope.com/u/zoid)\
**Post date:** [January 18, 2006, 2:53pm UTC](https://boards.straightdope.com/t/ms-access-cancel-the-before-update-event/340511/1 "2006-01-18T14:53:58Z")

</div>

I have the following code in the BeforeUpdate event of a combo box on my main form…

```auto

Private Sub ResBox_BeforeUpdate(Cancel As Integer)

Dim Resp
Dim MyUpdate As String
Dim MyDate As Date

MyDate = Format(Date, "Short Date") & " " & Format(Time(), "Long Time")

Resp = MsgBox("Do you want to update the Resolution?", vbYesNo)
If Resp = vbNo Then
    **DoCmd.CancelEvent**
    Exit Sub

ElseIf Resp = vbYes Then
    Do other stuff
End If

End Sub

```

The problem is the bold line. No matter what I do I cannot find a way to cancel the event and make the combo box NOT update. I’ve also tried…

```auto

Cancel = True

```

to no effect.

As an addtional hint, after clicking No in the message box, I cannot move to the next record or to another control without the messagebox re-appearing.

So how do I undo the update to the combo box?

---

<div class="post-metadata">

**Author:** ![zoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zoid/32/336_2.png) [@zoid](https://boards.straightdope.com/u/zoid)\
**Post date:** [January 18, 2006, 4:55pm UTC](https://boards.straightdope.com/t/ms-access-cancel-the-before-update-event/340511/2 "2006-01-18T16:55:27Z")

</div>

Just as an FYI for anyone following ths or with a similar problem…

I just needed to add “Me.Undo” right before the line “Cancel = True”  
:smack:
