Bob Richardson said:
While typing in a drop-down list, the user click a button on the
form. This is triggering an onClick event in the Drop-down list, not
in the button. What's happening and how can I prevent the drop-down
list from executing it's click event?
The combo box's Click event fires when its value is updated by user
action, immediately after the AfterUpdate event fires. So if the user
is typing in the list, and then clicks some other control such as a
command button, the combo box's value will be updated and its
AfterUpdate and Click events will fire -- *before* the Click event of
the command button. It's not a case of the wrong event firing, it's
that the combo's Click event fires first.
If you don't want the combo box's Click event to fire under those
circumstances, the only way you can do it is to undo the changes to the
combo box before moving the focus to some other control. The user could
press the Escape key to do this. I can't think of another way to
prevent the combo box's Click event from firing under these
circumstances, except by cancelling its BeforeUpdate event and undoing
the change by calling the control's Undo method. But that won't let the
focus move immediately to the command button or other control; instead,
the combo box will keep the focus until the user clicks on the button
again.
What exactly are you trying to accomplish by undoing the combo box?
Maybe there's a workaround.