I'm confused. A multiselect listbox doesn't have "a selected record" -
it has zero, one, several, or all selected. Scrolling to "the selected
record" is ambiguous or meaningless!
Could you explain what you're trying to accomplish from the user's point
of view? What is this listbox being use for, if not to allow the user to
freely select from the choices it displays?
Hi John,
Sorry the reply was so long in coming. This listbox is actually in
multiselect mode all the time, as far as Access is concerned. I want it to
be dual duty however, and the multiselect property can't be changed in
code, so...
I keep a software switch of my own for mode switching. If in my
single select mode, when a click event occurs, I requery the main forms row
source to display the selected record's details.
There are occasions when the user will want to group records to
process them together, rather than just updating the one record's details.
In this mutiselect mode, I don't refresh the main form while selection of
records is being done, and switch right back to single mode as soon as the
selections are processed.
This all works fine, and, although sounds a little convoluted, makes
for a very smooth UI for this form.
There is also a need to search the records in the listbox recordset,
when in single mode, and move to the found record. Also, there are times in
single mode, when the user changes a piece of detail information on the
selected record that warrants the list being resorted or requeried.
Finding a desired record or going back to the active record after a
requery isn't hard. Once found, I can make a record be selected with the
selected property. If the active record doesn't just happen to be in the
top few rows of the listbox, it's not displayed, though. I want to be able
to make the listbox scroll to any single selected record.
Ah, but can it be done?
- Max