Combo Box Dropdown

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here's another combo box question.

I like it when the user start to key in a combo box for it to automatically
dropdown and zone in on the desired selection.

I have done this using the keypress event, but I have to exclude certain
Ascii codes (tab, Enter) in order for the combo box to work correctly.
Again, this works, but I was looking for a simpler way.

TIA

Paul Hammond
Richmond, VA

--
 
Are you using the Dropdown method of the combo box?

You could use the Change event of the combo box to automatically cause the
dropdown list to show when a key is pressed and the key is the first
character for the combo box entry (though, as a user, I wouldn't necessarily
like that result all the time):

Private Sub ComboBoxName_Change()
If Len(Me.ComboBoxName.Text & "") = 1 Then Me.Dropdown
End Sub
 
I got this work without the "if" statement, but not with it. One problem,
if the user uses a mouse click to pick out the selection, the list will not
close. It feels like the selection has been ignored, when it hasn't.

This forces the user to tab or click elsewhere, which doesn't feel natural
with combo box open. It seems, 6 of one, 1/2 dozen of another

PH
 
Yes, had forgotten that the clicking of an item in the combo box's dropdown
list also causes the Change event to occur. And, if the user has typed at
least letter/number into the combo box (assuming that you're using it
without the If statement), the list will remain open when he/she clicks the
item. Coding around this natural behavior may be unnecessarily burdensome
work.....

Not sure why it didn't work with the If statement? Did you get an error of
some type? What happened?

Per Karl's question, cannot AutoExpand just do this for you? Or perhaps you
might like a spin box next to the combo that would allow the user to scroll
the list without dropping it down (see
http://www.cadellsoftware.org/SampleDBs.htm#Cbospin)?

--

Ken Snell
<MS ACCESS MVP>
 
I actually did get your code to work, but I had to turn autoexpand off, since
it autmatically filled in the entire box and the text length was alway more
than 1.

Seems like some coding is the only way to go here.

I just like the dropdown with the autoexpand feature on, it feels natural
and fast.


Paul
 
Paul Hammond said:
I actually did get your code to work, but I had to turn autoexpand off,
since
it autmatically filled in the entire box and the text length was alway
more
than 1.


Ahhhh... yes, that would be the result of AutoExpand.
 
Again, I think I am making a simple task, difficult. Lookinig at the
character set values I think this should give me the functionality I want.

Private Sub cboCallResultCode_KeyPress(KeyAscii As Integer)
If KeyAscii > 31 Then Me.cboCallResultCode.Dropdown
End Sub

Paul
 
Back
Top