I have the following code in the BeforeUpdate event of a combo box on my main form…
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…
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?