Searching through list box based on query

  • Thread starter Thread starter tom
  • Start date Start date
T

tom

I have a list box based on a query. When you hit the first
character of the query it takes you to the records that
begin with that character.

When you hit another character, it takes you to the
records that begin with this new character. I would
like it to go to the records whose second character matches the second
character hit on the keyboard.
 
I have a list box based on a query. When you hit the first
character of the query it takes you to the records that
begin with that character.

When you hit another character, it takes you to the
records that begin with this new character. I would
like it to go to the records whose second character matches the second
character hit on the keyboard.

Then use a combo box, not a list box.
Set the Combo box AutoExpand property to Yes.
 
Tom
Place a Text box on your form and call it txtData (or whatever) and in the
On Change event enter :-

YourListBox.Requery

replace the name with your list box name. In the query attached to the list
box enter :-

Like [txtData ].[Text] & "*"

in the Criteria row of the field you want to filter. When you open the form
the list box should show all entries and as you enter text into the Text box
the list should filter down to the entries that start with the characters
entered. You could also show entries that have the entered characters in any
position if you use the Criteria :-

Like "*" & [txtData ].[Text] & "*"

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top