Search list box form text box

  • Follow


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.

0
Reply Utf 1/2/2010 1:29:01 AM

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/
__________________________________________

"wlhj@news.postalias" wrote:

> 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.
0
Reply Utf 1/2/2010 1:43:01 AM


1 Replies
561 Views

(page loaded in 0.062 seconds)

Similiar Articles:
















7/18/2012 2:36:30 PM


Reply: