R
riccifs
Does anyone to known how to code a combo box so that when I start to
type something, it drops down its list of items?
At moment I'm using that code;
Private Sub Form_KeyPress(KeyAscii As Integer)
Dim ctlCurrentControl As Control
Dim lngType As Long
Set ctlCurrentControl = Screen.ActiveControl
lngType = ctlCurrentControl.Properties("ControlType")
If lngType = 111 Then 'Combo Box (see the Object Browser)
If KeyAscii > 32 Then
Screen.ActiveControl.Dropdown
End If
End If
Set ctlCurrentControl = Nothing
End Sub
It seems to work but recently I discovered a bug in it.
If I click on the record selectors (the one on the extreme left side
of the form) and after hit the Esc key, I got error on this part of
the code "Set ctlCurrentControl = Screen.ActiveControl" telling me
"the expression you entered requires the control to be in the active
window".
Who knows how to help me?
Many thanks...
Stefano.
type something, it drops down its list of items?
At moment I'm using that code;
Private Sub Form_KeyPress(KeyAscii As Integer)
Dim ctlCurrentControl As Control
Dim lngType As Long
Set ctlCurrentControl = Screen.ActiveControl
lngType = ctlCurrentControl.Properties("ControlType")
If lngType = 111 Then 'Combo Box (see the Object Browser)
If KeyAscii > 32 Then
Screen.ActiveControl.Dropdown
End If
End If
Set ctlCurrentControl = Nothing
End Sub
It seems to work but recently I discovered a bug in it.
If I click on the record selectors (the one on the extreme left side
of the form) and after hit the Esc key, I got error on this part of
the code "Set ctlCurrentControl = Screen.ActiveControl" telling me
"the expression you entered requires the control to be in the active
window".
Who knows how to help me?
Many thanks...
Stefano.