txtAutoComplete



'dichiarazione nell'area del form

Public IsDelOrBckSpce as Boolean

Private Sub Text1_Change()

Dim OldLen As Integer
Dim ds As Recordset
OldLen = Len(Text1.Text)

If Not IsDelOrBckSpce Then
If Not Text1.Text = "" Then
Set ds = Data1.Database.OpenRecordset("select Author from Authors _
where Author like '" & Text1.Text & "*'", dbOpenDynaset)
If Not ds.RecordCount = 0 Then
ds.MoveFirst
Text1.Text = ds!Author
If Text1.SelText = "" Then
Text1.SelStart = OldLen
Else
Text1.SelStart = InStr(Text1.SelText, Text1.Text)
End If
Text1.SelLength = Len(Text1.Text)
End If
End If
End If

End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyBack Or KeyCode = vbKeyDelete Then
IsDelOrBckSpce = True
Else
IsDelOrBckSpce = False
End If
End Sub

(txtautocomplete.html)- by Paolo Puglisi - Modifica del 25/3/2019