combobox shortcut

  • Thread starter J Holtendehouzer
  • Start date
J

J Holtendehouzer

I have a combobox that I'm trying to build a shortcut into--when the user
types in a two-letter combination, the combobox selects the long name
corresponding to that combination (e.g., typing "GH" and leaving the field
should automatically select "Green Hills Drive" within the combobox.

I'm having trouble, though. I initially put my code in the NotInList event.
I simply look for the two-letter code in the source table (where the
shortcut and the long name are both stored), then set the value of the
combobox to the key I find there. I handle the error if the user enters a
shortcut that doesn't exist.

My problem is that after all of that, the code works, but the combobox
automatically drops down its list. Should I put the code in a different
event?

I tried BeforeUpdate, which made more sense, but it wouldn't let me modify
the value of the combobox from that event (why is that, by the way?).
Anywho, any help would be appreciated!

Joe
 
A

Allen Browne

Presumably the combo's RowSource is a table of valid values. Is there any
chance that you could use the abbreviated text value as the primary key of
this lookup table? The full text would then be in the next column. When the
combo is dropped down, the user then selects the text by typing the
abbreviated text, and sees the full text in the 2nd column.

This is something I do frequently. 24-characters is usually enough for the
abbreviated value.
 

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