ComboBox ListIndex changes to -1

A

AirPo

I have a simple form with a combobox and a button. The button is only
enabled when the user selects someting from the dropdown list. The
logic to do this is the button is disable if the listindex property is
-1, enabled otherwise. This happens in the change event. The problem
is that sometimes even though I select an item from the dropdown, when
the change event fires, the listindex value is -1, and the button is
disabled even though something is selected.

Anyone?
 
D

Damon Heron

Change event doesn't fire when user selects an item in a list. Use the
click event.
 
J

John Vinson

I have a simple form with a combobox and a button. The button is only
enabled when the user selects someting from the dropdown list. The
logic to do this is the button is disable if the listindex property is
-1, enabled otherwise. This happens in the change event. The problem
is that sometimes even though I select an item from the dropdown, when
the change event fires, the listindex value is -1, and the button is
disabled even though something is selected.

Anyone?

Use the AfterUpdate event instead. Change is too much a hairtrigger -
it fires AT EVERY KEYSTROKE, not when a value is selected.

John W. Vinson[MVP]
 
D

Damon Heron

John,
This from Access Help on Change Event -
"The Change event doesn't occur when a value changes in a calculated control
or when you select an item from the combo box list."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top