ListBoxTypeIn.mdb (intermediate)

Please consider donating $1 per sample downloaded, find out why here
Download
ListBoxTypeIn.zip
Access 97 (33 KB)

These forms illustrate how to use a binary search routine to jump to a value in a list box as you are typing in a text box. It is similar to how the Index tab works in Windows Help files. Try typing "Smythe" in the "Target" box. Then backspace and type "Sands".

As you type in the "Target" box (txtTarget) the OnChange event triggers the binary search (BSearch) and the appropriate value in the list gets highlighted.

To make it work, you need only copy the list and textboxes along with the function "BSearch" and the sub "txtTarget_Change" into your form, along with the Global variable definition: "Dim itemindex As Integer".

The Recursive Example uses a recursive function, i.e., one which calls itself. The Non-recursive Example replaces the recursion with a Do Loop. Otherwise they work identically.

 

Feedback

 

Need Winzip?

Return to Main Page