Dear all,
I am trying to have a combo box for auto complete. I have entered
following codes combo4_change. But I am not getting the resulst. Can any
one help me to correct the mistake .
Thanks in advance.
Krishnadas
--------------------
private Sub Combo4_Change()
Dim strText, strFind
If Len(Trim(strText)) > 0 Then
strFind = "Name Like '"
For i = 1 To Len(Trim(strText))
If (Right(strFind, 1) = "*") Then
strFind = Left(strFind, Len(strFind) - 1)
End If
strFind = strFind & "*" & Mid(strText, i, 1) & "*"
Next
strFind = strFind & "'"
strSQL = "SELECT table1.nkey,table1.tname SortOrder FROM table1
Where " & _
strFind & " ORDER BY SortOrder;"
Me.Combo4.RowSource = strSQL
Else
strSQL = "SELECT table1.nkey,table1.tname, Name.SortOrder FROM tName
ORDER BY table1.SortOrder; "
Me.Combo4.RowSource = strSQL
End If
Me.Combo4.Dropdown
End Sub