Sorry to post such a dumb request but this is driving me up the wall.
I have a combobox where in the after update I have some code which goes off and does somethings depending on the value selected. Now I want to verify the selected value before accepting it (i.e before running the code of AfterUpdate).
So I thought the following code would do it:
--------------
Private Sub Combo0_BeforeUpdate(Cancel As Integer)
If Me.Combo0 = "test" Then
Cancel = True
Me.Combo0.Undo
End If
End Sub
-------------
This stops the AfterUpdate code running ok when option "test" is selected but I want the combo box value to return to the previous value that it had before "test" was selected. I thought that's what the Undo method would do but it just sits there with the value "test" (looking all smug and self satisfied).
Can't believe this is giving me so much grief.
I have a combobox where in the after update I have some code which goes off and does somethings depending on the value selected. Now I want to verify the selected value before accepting it (i.e before running the code of AfterUpdate).
So I thought the following code would do it:
--------------
Private Sub Combo0_BeforeUpdate(Cancel As Integer)
If Me.Combo0 = "test" Then
Cancel = True
Me.Combo0.Undo
End If
End Sub
-------------
This stops the AfterUpdate code running ok when option "test" is selected but I want the combo box value to return to the previous value that it had before "test" was selected. I thought that's what the Undo method would do but it just sits there with the value "test" (looking all smug and self satisfied).
Can't believe this is giving me so much grief.