Scroll a listbox to a given value ?

  • Thread starter Thread starter mscertified
  • Start date Start date
M

mscertified

Is there any way to scroll a listbox (using VB code) so that a given value is
on the top line?

Thanks.
 
Since you posted a fairly generic question, the fairly generic answer is
that you could set the default value of the listbox.

If you post a more specific description of your situation, you'll probably
get more generic suggestions.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
OK.... I have 2 listboxes, both list names of people. The first listbox
represents inactive records and the second listbox represents active records.
This is a screen that allows inactive records to be deleted by replacing them
with active records. Normally records will be replaced by similar records (a
record having a similar name possibly with a slightly different spelling).
Both listboxes are big (10,000 rows), so scrolling is painful. The first
listbox is multi-select and the second single-select.

What I want to do is when the user clicks in the first listbox, I want to
position the second listbox to a similar name (>= value). The exact same name
may not be there. I do not want to select the row, just position the listbox.
This technique will hopefully eliminate the need for a lot of scrolling.
 
An alternate approach to consider when you have listboxes with "thousands of
rows" would be to require the entry of two or three (or more) characters
BEFORE the listbox is filled. This would limit the total number of rows
loaded. See AllenBrowne.com for more info on how.

Or consider using comboboxes instead of listboxes (again, with the above
2,3,more characters before loading).

I've used the combination of a textbox and a listbox ... the first 'n'
characters get entered into the textbox, then the listbox is loaded with the
records "containing" the characters entered.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Consider posting back the solution you find. Other folks may be in a
similar situation in the future and your work could benefit their efforts.\

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top