Link to home
Start Free TrialLog in
Avatar of Robert Berke
Robert BerkeFlag for United States of America

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
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Strange -

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.
odd ... because it does not work for me ... w/o the change I made.

mx
Capture1.gif
Avatar of Robert Berke

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.