Search in listbox...

  • Thread starter Thread starter Klerman Gutierrez
  • Start date Start date
K

Klerman Gutierrez

Hello,
Access 2000.
I have this listbox with 2 columns. One for the ID, and another for the
names ordered alphabeticaly. Is there a way to search for data in the second
column instead of implementing my own search algorithm ?.
MTIA,
Klerman
 
Can you provide a bit more description of what you mean when you say "search
for data"? The first thing that came to my mind on reading your post was
using a combobox with AutoComplete turned on, rather than a listbox.
 
Jeff.
I want to recreate the functionality of a dropdown box using a text box and
a list box. As I type in the text box, the text is searched in the rows of
the list, selecting the first row that matches the text. Is this search of
the first row what I want to be fast. Is there a function, property or
method in the list box that I could use to perform it ?.
TVMIA,

Klerman
 
Klerman

Check into the KeyPress and/or Change events of your text box, and use a
"dynamic" (built on-the-fly)SQL statement to re-set the source of your
listbox after each character is typed into your textbox.

That way, you can use typing "a" into the text box to create a SQL WHERE
clause something like:

"WHERE [YourField] Like " & Me!YourForm!YourTextBox & "*"

By the way, the combo box is, as you suggest, functions much like the
combination of a textbox and a listbox. Any particular reason why you don't
want to use it? (just curious)
 
Jeff,
I need the list portion of the combobox permanently open. But the combobox
doesn't have this functionality.
This is a SQL database that could have several hundreds if not thousands of
rows in the customers table, that is one of the lists the user has to deal
with.
I don't think that requerying such a table each time the user presses a key
would be a good idea. This is why I would like to work with the contents of
the list that is updated once, when the form is opened.

Regards,

Klerman
 

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

Similar Threads


Back
Top