Is it possible to have an auto complete from different fields using COMBO BOX?
Data fields :
Field 1 : IdNumber
Field 2 : eLast
Field 3 : eFirst
Example : Format (Id number - Lastname, Firstname)
E-0001 - BOND, James
E-0002 - Galema, Zumma
E-0003 - De Leon, Bokyo
E-0004 - Paradise, Pinky
for example
I search for letter "A" all records with letter "A" will be displayed on Combo Box with this Format (Id number - Lastname, Firstname)
I have a sample code but only works for 1 field.
Keyup Event
Any HELP?
Data fields :
Field 1 : IdNumber
Field 2 : eLast
Field 3 : eFirst
Example : Format (Id number - Lastname, Firstname)
E-0001 - BOND, James
E-0002 - Galema, Zumma
E-0003 - De Leon, Bokyo
E-0004 - Paradise, Pinky
for example
I search for letter "A" all records with letter "A" will be displayed on Combo Box with this Format (Id number - Lastname, Firstname)
I have a sample code but only works for 1 field.
Keyup Event
Code:
Dim intCurPos As Integer
Dim lRow As Long
Dim sqlCriteria As String
sqlCriteria = "SELECT cClient FROM SQL_Employee ORDER BY eLast, eFirst ASC"
Set RS = New ADODB.Recordset
RS.CursorLocation = adUseClient
RS.CursorType = adOpenForwardOnly
RS.LockType = adLockReadOnly
RS.Open sqlCriteria, cn
If KeyCode = vbKeyBack Or KeyCode = vbKeyDelete Then Exit Sub
With RS
If Trim$(cboSearch.Text) <> "" Then
.MoveFirst
.Find "eLast LIKE '" & Trim$(cboSearch.Text) & "*' "
If Not .EOF Then
intCurPos = cboClient.SelStart
cboSearch.Text = RS!eLast
cboSearch.SelStart = intCurPos
cboSearch.SelLength = Len(cboSearch.Text)
End If
End If
End With
Set RS = Nothing