Text Box Auto Fill
This simple code allows to make an auto-filled textbox (like an adress box in IE). This example uses an DataEnvironment connection, but it can be easy used in any other cases.
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
Private Sub txtSTREET_KeyUp(KeyCode As Integer, Shift As Integer)
Dim PrevLength As Integer, PrevStart As Integer
If Not KeyCode >= 65 Then Exit Sub
If firstcome Then firstcome = False: Exit Sub
With DataEnvironment.Connection1.Execute("SELECT ADDRESS from tblFlats WHERE UCASE(ADDRESS) like '" & UCase(Me.txtSTREET) & "%'")
If Not .EOF Then
If Not Me.txtSTREET = "" Then
PrevStart = Len(Me.txtSTREET) + 1
PrevLength = -Len(Me.txtSTREET) + Len(!ADDRESS)
Me.txtSTREET.SelStart = PrevStart
Me.txtSTREET.SelLength = PrevLength
Me.txtSTREET.SelText = Mid$(!ADDRESS, Len(Me.txtSTREET) + 1)
Me.txtSTREET.SelStart = PrevStart - 1
Me.txtSTREET.SelLength = PrevLength
End If
'Else
'MsgBox "The entered fragment is not found in the list!"
'Me.STREET = ""
End If
End With
End Sub
Upload
Upload
Original Comments (3)
Recovered from Wayback Machine