Robert Berke
asked on
vba to select a combo box entry
I have a combo box which shows a state, city and zip code. The user types a state name then selects the correct zipcode record.
I also have a text box in which the user can key a zip code. Txtbox_exit uses the zipcode to force the combo box to show that state.
The attached mdb file shows my problem. When txtbox_exit is done, the wrong record is highlighted.
What am I doing wrong. (Please don't suggest radically different approaches, I want to keep the general structure as is.)
show-problem.png
db10.mdb
I also have a text box in which the user can key a zip code. Txtbox_exit uses the zipcode to force the combo box to show that state.
The attached mdb file shows my problem. When txtbox_exit is done, the wrong record is highlighted.
What am I doing wrong. (Please don't suggest radically different approaches, I want to keep the general structure as is.)
show-problem.png
db10.mdb
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, that is much simpler.
mbizup: You are correct, sometimes my code seemed to work. Other times it did not. I have no idea why.
but Mx code seems perfect.
mbizup: You are correct, sometimes my code seemed to work. Other times it did not. I have no idea why.
but Mx code seems perfect.
It is working perfectly for me.
I can type in 22222, then tab out of the textbox, or click somewhere else, and the second row of the combo is correctly highlighted.