I am using the following code to automatically retrieve matching information from a database and populate a text box as the user types each letter.
It works fine unless the user wants to backspace right back to the beginning (if, for example, they type the first letter wrong) or if they want to completely delete text in the textbox. This code will not allow the user to delete the first letter they type and leave an empty textbox.
How can I fix this?
Code:
lngOrigPos = txtLName.SelStart
Set rs = GetArtist(strName, strField)
If Not rs.EOF Then
With rs
.MoveFirst
If Not IsNull(!Lname) Then
txtLName.Text = !Lname
End If
If Not IsNull(!FName) Then
txtFName.Text = !FName
End If
txtArtistID = !artistID
txtLName.SelStart = lngOrigPos
txtLName.SelLength = Len(txtLName.Text)
End With
End If
How can I fix this?