I have a bound combo box control named Publisher_ID and Row Source:
(2 columns, widths: 0cm,2cm). I want it to dropdown by itself as soon as it is reached by pressing Tab keys, so I have a code in On Enter event:
In the On Change event,
The Problem is that even when I reach the combo by pressing the Tab key, it opens for a second and then is closed. Also, it continues to clicker while typing in the combo. This has been a headache for me for several days. Can you help me with this? AutoExpand has been set to both yes and no, but to no effect.
Code:
SELECT Publishers.Publisher_ID, Publishers.PublisherName FROM Publishers;
Code:
Private Sub Publisher_ID_Enter()
Me.Publisher_ID.Dropdown
End Sub
Code:
Private Sub Publisher_ID_Change()
On Error GoTo ErrorHandler
Dim searchText As String
Dim sql As String
If isFiltering Then Exit Sub
searchText = Nz(Me.Publisher_ID.Text, "")
If Len(searchText) > 0 Then
isFiltering = True
sql = "SELECT Publishers.Publisher_ID, Publishers.PublisherName FROM Publishers WHERE PublisherName LIKE '*" & searchText & "*' ORDER BY PublisherName"
Me.Publisher_ID.RowSource = sql
If Me.Publisher_ID.ListCount > 0 Then
Me.Publisher_ID.Dropdown
End If
isFiltering = False
Else
Me.Publisher_ID.RowSource = "SELECT Publishers.Publisher_ID, Publishers.PublisherName FROM Publishers"
Me.Publisher_ID.Dropdown
isFiltering = False
End If
Exit Sub
ErrorHandler:
isFiltering = False
End Sub
Comment