By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,808 Members | 1,481 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,808 IT Pros & Developers. It's quick & easy.

Using Textbox to search for an item from a ListBox

100+
P: 106
I have a list box called CCList which displays a field form table based on a query
Expand|Select|Wrap|Line Numbers
  1. SELECT CC.table1 FROM table1 ORDER BY CC.table1; 
  2.  
Each CC consists of 5charecter starting with a letter the rest is number (e.g.: A0214. D2145,Y0568 and etc...)

The list box is huge so the user needs to scroll down to find what they looking for.
To make it easier for the user I have created a textbox to perform a search.
I want the user to enter either the first letter or the item number in the text box and based on the user input the CCList should jump to that (input) item.

I was just wondering how I can do this.
Dec 13 '06 #1
Share this Question
Share on Google+
7 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Similar answer to previous question Tara.

Set the list box row source to the following:

Expand|Select|Wrap|Line Numbers
  1. SELECT CC.table1 FROM table1 
  2. WHERE CC.table1 Like [Forms]![FormName]![textboxName]*
  3. ORDER BY CC.table1;
  4.  
Put the Me.listboxName.Requery statement either in the after update event of the textbox or behind a command button.

Mary
Dec 13 '06 #2

missinglinq
Expert 2.5K+
P: 3,532
Wouldn't it be easier for the user if a combobox was used with Auto Expand set to YES?
Dec 13 '06 #3

NeoPa
Expert Mod 15k+
P: 31,489
Wouldn't it be easier for the user if a combobox was used with Auto Expand set to YES?
For the first part Yes.
For the second that wouldn't help - good point to bring up though :).
Dec 14 '06 #4

100+
P: 106
Similar answer to previous question Tara.

Set the list box row source to the following:

Expand|Select|Wrap|Line Numbers
  1. SELECT CC.table1 FROM table1 
  2. WHERE CC.table1 Like [Forms]![FormName]![textboxName]*
  3. ORDER BY CC.table1;
  4.  
Put the Me.listboxName.Requery statement either in the after update event of the textbox or behind a command button.

Mary
Mary
I put
Expand|Select|Wrap|Line Numbers
  1. SELECT CC.table1 FROM table1 
  2. WHERE CC.table1 Like [Forms]![FormName]![textboxName]*
  3. ORDER BY CC.table1; 
Behind the row source of my list box, it complains about syntax error which is the [textboxName]* when I delete the sign * than it doesn't display any thing the list.
It just wait for the user to enter something in the textbox if it exist than you will see it on the List box.
/???
Dec 14 '06 #5

MMcCarthy
Expert Mod 10K+
P: 14,534
Mary
I put
Expand|Select|Wrap|Line Numbers
  1. SELECT CC.table1 FROM table1 
  2. WHERE CC.table1 Like [Forms]![FormName]![textboxName]*
  3. ORDER BY CC.table1; 
Behind the row source of my list box, it complains about syntax error which is the [textboxName]* when I delete the sign * than it doesn't display any thing the list.
It just wait for the user to enter something in the textbox if it exist than you will see it on the List box.
/???
Try this ...

Expand|Select|Wrap|Line Numbers
  1. SELECT CC.table1 FROM table1 
  2. WHERE CC.table1 Like [Forms]![FormName]![textboxName] & "*"
  3. ORDER BY CC.table1; 
  4.  
Dec 15 '06 #6

100+
P: 106
Try this ...

Expand|Select|Wrap|Line Numbers
  1. SELECT CC.table1 FROM table1 
  2. WHERE CC.table1 Like [Forms]![FormName]![textboxName] & "*"
  3. ORDER BY CC.table1; 
  4.  
Thanks Mary

It is fine now
Dec 18 '06 #7

MMcCarthy
Expert Mod 10K+
P: 14,534
Thanks Mary

It is fine now
That's great Tara

Mary
Dec 18 '06 #8

Post your reply

Sign in to post your reply or Sign up for a free account.