Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting from an automatically populating textbox

Status
Not open for further replies.

anet

Programmer
Jul 10, 2001
35
CA
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.
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
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?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top