Scrolling to a record in a List Box

DataMiner

Registered User.
Local time
Today, 07:15
Joined
Jul 26, 2001
Messages
336
I have a function that uses VB to select a record in a multiselect list box, based on a value that the user enters in a text box. That works fine, except.... when the item selected is further down the list than what's initially visible on the screen, the list box does NOT automatically scroll down to make the selected item visible. How do I make it do this????

My constraints are:
1. The list box contains many (more than 100) items
AND
2. multiselect = extended

What I'm trying to do is make it easier for users to find items in long lists. Surely there must be a way to control the vertical scrolling in a list box????

Access 2002, BTW

Thanks for any suggestions!
 
Thanks, the ListIndex thing was just what I needed.

Now, I have one remaining problem:


1. User enters, say "F" in the text box.
2. VB
(a)determines the listindex number for the first item starting with "F"
(b) moves the focus to the listbox
(c) sets the listindex to the correct item, so now the listbox shows the selected item as the first item starting with "F"

Fine, so far...

However, I want the focus to now change back to the text box, and have the text box be waiting for the user to enter the next letter, to do an "incremental search"... so now the user enters an "L", the text box shows "FL" and the listbox moves to the first item beginning with "FL".

The problem is that when I move the focus back to the text box, whatever the user types will replace what was there before. How do I make it add to what's there instead?


By the way, I'm using IncrementalSearch class module described in the Access 2002 developer's handbook (Getz, et al),with some minor edits to allow it to handle mutiselect listboxes.
 

Users who are viewing this thread

Back
Top Bottom