Filtering a combo box...

C

Craig Armitage

Hi,

I have a combo/dropdown box that shows all my customers (2000+) but
obviously its difficult to find the exact customer i want.. The textbox part
of the combo box will go to the first entry as i type which is ok but i
would like it to filter down to show only the people that match what im
typing as i type it..

for example

i type "w" and the combo shows..

David Williams
Walter Jones
William Smith

then i type the 'i' and get

David Williams
William Smith


is this possible with a combo box?
 
J

Jane Laflamme

how come my inbox is not is not set in my left colun,and my delete word is
not leasted
 
A

Armen Stein

Hi,

I have a combo/dropdown box that shows all my customers (2000+) but
obviously its difficult to find the exact customer i want.. The textbox part
of the combo box will go to the first entry as i type which is ok but i
would like it to filter down to show only the people that match what im
typing as i type it..

for example

i type "w" and the combo shows..

David Williams
Walter Jones
William Smith

then i type the 'i' and get

David Williams
William Smith


is this possible with a combo box?

Well, not exactly with a combobox. But you could get a similar affect
using a text box with a listbox underneath. This technique assumes
you are familiar with some VBA coding. If you aren't, you could ask
an Access developer to write this one piece for you.

In the text box, add code to the Change event. This event fires when
the user types each character or changes the value. The code can
build a SQL statement that includes a WHERE MyField LIKE
"*MyTextBoxValue*" and changes the RowSource of the listbox below to
use it. Don't forget to remove the WHERE clause entirely when the
text box is empty.

Be aware that this is quite intensive processing, and may cause delays
as the user is typing. But it would give you the capability you are
asking for.

Another way to approach this problem is to provide a read-only
continuous form to allow the user to search for customers using
multiple criteria, including a LIKE. Then when they've found the
correct customer, they drill down on that record to see and edit their
details. Something like
http://www.jstreettech.com/images/taxCreditsAllocation.jpg, but with
the selection criteria editable at the top of the form.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 

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