G
Guest
My goal is to have the user start typing a customer's name in the combo box
then have the same combo box only show records to choose from what the user
started typing. I have the following code which I got from a previous thread
- I'm still able to start typing a customer's name and the first customer
with those letters populates the combo box - but when I click on the down
arrow to view the rest of the customers that start with those characters, it
takes me to the last record of which the combo can hold (the 65, 653
record??). So If I started typing "TEX", it'll show "TEXAS..." but when the
drop down is clicked it shows customers that start with J. Please help.
Dim sCombo26 As String
Const conCombo26Min = 1
Function ReloadCombo26(sCombo26 As String)
Dim sNewStub As String ' First chars of COMPANY_NAME.Text
sNewStub = Nz(Left(sCombo26, conCombo26Min), "")
' If first n chars are the same as previously, do nothing.
If sNewStub <> sCombo26 Then
If Len(sNewStub) < conCombo26Min Then
'Remove the RowSource
Me.Combo26.RowSource = "SELECT CL_NAME, CL_ID,
BRCH_LOCATION_CODE FROM Qry_Customer_Lookup WHERE (False);"
sCombo26 = ""
Else
'New RowSource
Me.Combo26.RowSource = "SELECT CL_NAME, CL_ID,
BRCH_LOCATION_CODE FROM Qry_Customer_Lookup WHERE (Combo26 Like """ & _
sNewStub & "*"") ORDER BY CL_NAME, CL_ID, BRCH_LOCATION_CODE;"
sCombo26Stub = sNewStub
End If
End If
End Function
then have the same combo box only show records to choose from what the user
started typing. I have the following code which I got from a previous thread
- I'm still able to start typing a customer's name and the first customer
with those letters populates the combo box - but when I click on the down
arrow to view the rest of the customers that start with those characters, it
takes me to the last record of which the combo can hold (the 65, 653
record??). So If I started typing "TEX", it'll show "TEXAS..." but when the
drop down is clicked it shows customers that start with J. Please help.

Dim sCombo26 As String
Const conCombo26Min = 1
Function ReloadCombo26(sCombo26 As String)
Dim sNewStub As String ' First chars of COMPANY_NAME.Text
sNewStub = Nz(Left(sCombo26, conCombo26Min), "")
' If first n chars are the same as previously, do nothing.
If sNewStub <> sCombo26 Then
If Len(sNewStub) < conCombo26Min Then
'Remove the RowSource
Me.Combo26.RowSource = "SELECT CL_NAME, CL_ID,
BRCH_LOCATION_CODE FROM Qry_Customer_Lookup WHERE (False);"
sCombo26 = ""
Else
'New RowSource
Me.Combo26.RowSource = "SELECT CL_NAME, CL_ID,
BRCH_LOCATION_CODE FROM Qry_Customer_Lookup WHERE (Combo26 Like """ & _
sNewStub & "*"") ORDER BY CL_NAME, CL_ID, BRCH_LOCATION_CODE;"
sCombo26Stub = sNewStub
End If
End If
End Function