Search list box form text box

W

wlhj

I hope I am in the right place. I found this site looking for a solution on
google. I am working with Access 2007.

I have an application I'm working on that requires a list box for selection.
OK. I can do that. I am working with a customers table and for simplicity
we'll say it has an auto number field, last name, first name, and ss # field.
I have created a list box, and I can highlight a record and select it for
editing.

The problem is that as this database grows, I would like to have a text box
where the user can search by last name or ss # and it would go to and
highlight the first record matching their criteria in the list box as they
typed. They would still use the list box for the record selection, but this
would help them find a record in the middle very quickly without scrolling.

I would either use buttons or radio buttons for the selection type (last
name or ss #).

I need the record in the list box to have focus as they type. I can't find
any examples anywhere for this.

Hope I'm not over my head.
 
T

Tom Wickerath

Hi wlhj,

You could have a command button on the form where the click event includes
code to grab the value you type in the text box, as long as it is not null,
ie.:

If Len(TextboxName & "") > 0 Then

and then uses this in the WHERE clause of a SQL statement to change the Row
Source for your list box. Take a look at this article:

Access Cookbook: Chapter 8 Excerpt: Make Slow Forms Run Faster
http://msdn.microsoft.com/en-us/library/aa188218(office.10).aspx

Scroll down to the section sub-titled "Combo and list box controls", about
1/3 of the way down.

I need the record in the list box to have focus as they type. I can't find
any examples anywhere for this.

Do you really need this? Only one control can have focus at a time, so the
text box that one is entering data into has the focus.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
 

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

Top