Combobox and Arrow Keys

ray_charles

Registered User.
Local time
Today, 18:42
Joined
Aug 5, 2002
Messages
18
Ok. I have been searching for this topic, and seem to have struck out, so here goes.

I have a combobox with People's Names in it. When I start typing the combo displays the closest match as per normal. So - far - so - good. BUT, if I have a number of names that are close, I mouse
click the box to activate the drop down combo list so I can choose the name easier than continuing to type exact characters to find the right entry.

That is ok, but, it would be nice to activate the dropdown list by
pressing the down-arrow on the keyboard and then continue to
cursor up or down to find the correct name, instead of taking my
hand off the keyboard and using the mouse to click a dropdown
list and entry in that list.

I know about the on keydown event, but, how do I interpet the
keystroke to see if it is a down-arrow? If I can intercept this
keystroke, then, I can do something similar to me.dropdown,
and then continue to cursor where I want, right?

Thanx in advance to all :-)

Ray . . .
 
Hi Ray_Charles

Here's what I do.

On the 'On Got Focus' property of the combobox, use this code:

your_combobox_field_name.Dropdown

Now when you tab to the combobox, it will drop down automatically and you can then scroll via the keyboard arrows, find your selection and a normal keyboard return should do the trick.

I like to put a box over the arrow and colour it the same as my form. This way I never see the arrow, unless the box has focus.

Hope this is what you're after.
 
This is what worked for me.

Private Sub Combo0_KeyDown (KeyCode as Integer, Shift as Integer)

If KeyCode = 40 Then
Me.Combo0.Dropdown
End If

End If

If there's any other key you're trying to figure out, just put the line

msgbox KeyCode & " " & Shift

Into the event procedure and see what comes up.

Keagan
 
This will work ! ! !

Thank You Carl_R and KeaganQuilty!

Both of you have confirmed what I needed to know,
and the ability to find the key codes have many
applications :-)

Thanks again ! ! !

Ray . . .
 
Another simply way is to old down the Alt key and press the Down arrow to expland the combo box.

Or use the SendKey function in the OnEnter Event for the field
eg. =Sendkeys("%{Down}")

Lookup SendKeys Statement in help for complete list of keys.


Smed
 

Users who are viewing this thread

Back
Top Bottom