List Box

K

Kim

How do you you set it up so that if the user pushes the
down key, the list will drop down, I figure it's got to do
with the On Key Down event, but I don't know the syntax to
tell it to open the drop down list.
 
P

Phil R

You could use SENDKEYS "%{DOWN}" in the on enter property
of your list box. If it wont work try converting to a
combobox.
 
S

Sandra Daigle

Hi Kim,

When you say drop down it sounds as though you are referring to a combo box
instead of a listbox. If so, the combo has a method which is named DropDown.
To call it using the down arrow key first set the KeyPreview property of the
form to True then add the following to the KeyDown event of the combo. Note
that this has the unfortunate side effect of rendering the down arrow
useless when the combo is expanded so you can use the fIsComboOpen function
to detect this condition and circumvent the dropdown code. fIsComboOpen is
available courtesy of Dev Ashish at
http://www.mvps.org/access/api/api0052.htm.

Private Sub Combo9_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDown Then
If Not fIsComboOpen() Then
Me.Combo9.Dropdown
KeyCode = 0
End If
End If
End Sub
 

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