OnChange combo box

  • Thread starter Thread starter Confused Slug
  • Start date Start date
C

Confused Slug

I am using the On Change event to peform actions when the value selected in a
Combo box changes. However, if i select the value in the list which is the
same as the current value for the combo box the On Change event still sees
this as a change. How do i prevent this so that the On Change event only
occurs if the value selected in the list is different from the current combo
box value?
 
Confused said:
I am using the On Change event to peform actions when the value selected in a
Combo box changes. However, if i select the value in the list which is the
same as the current value for the combo box the On Change event still sees
this as a change. How do i prevent this so that the On Change event only
occurs if the value selected in the list is different from the current combo
box value?

Do not use the Change event for this. It fires for every
keystroke typed into the combo box's text portion. As your
question indicates, it doesn't provide the facilities to do
what you want either. Instead, you should perform your
actions in the combo box's AfterUpdate event.

If the combo box is bound to a record source field, you can
check the value against the combo box's OldValue property:

If Me.combobox <> Me.combobox.OldValue Then
'do your actions here
End If
 
Back
Top