Create a search box

plumba

Registered User.
Local time
Today, 19:14
Joined
Apr 7, 2009
Messages
13
Hi all

I have a form which is a master list of contact names, I have a text box at the bottom as the search field. THis is the way I would like it to behave: say for example when you enter the letter J in the search box the form limits or sorts records starting with J then you enter JO it list all starting with JO, then on and on so if I then entered JON it would would list all starting with JON.... you get the drift...

Ideally it would change with each letter enetere so it would not constantly need the user to press SEARCH after each key press.

Thanks in advance...
 
you need to look up the on change event for the text box. This fire every time a character is entered.

then either use a filter, or better still create a query that uses the contents of the text box in a LIKE statement, and just requery the form in the on change event for the text box.
 
Code:
Private Sub txtLastName_Change()
    cmdFind.SetFocus
    cmdFind_Click
    txtLastName.SetFocus
    txtLastName.SelStart = Len(txtLastName & "")
End Sub
 

Users who are viewing this thread

Back
Top Bottom