Filter as you type text box (1 Viewer)

bsacheri

New member
Local time
Today, 16:24
Joined
Aug 9, 2017
Messages
12
If you are looking for a solution for a combo box, I have contributed to a VBA Class that can be attached to any combo box and provide find-as-you-type capabilities. This is something that I had looked for for years so I feel I should share it on this site since this is similar to this thread topic.

Some features of this class:
  • It's fast. It keeps the list in memory and doesn't requery the database with each keystroke. I have used this class with a combobox containing over 12,000 records
  • It lets you search multiple columns. For example, First Name and Last Name can be in separate columns and the list will be reduced to show a match in either column.
  • It's a class. It can be attached to existing combo boxes without adding any event handler code behind existing combo boxes.
  • It automatically cleans up after itself when the form closes.

It can be intimidating if you haven't used a class before but it is not that hard. It comes down to a few steps.
  1. Add the class module to your VBA project.
  2. Declare a class variable at the top of your form code module.
  3. Add a line of code in Form_Load() to initialize the class variable and bind it to an existing combo box.
  4. Viola! Your combo box now has find-as-you-type behavior.

I created a downloadable demo database so you can see the class in action but I am new to this forum and don't have enough posts to include links. Add some .'s to the text below if you want to pursue further.
www tek-tips com/viewthread.cfm?qid=1778876
 

Users who are viewing this thread

Top Bottom