multiselect list box last selected

M

mark

Hi,
Is it possible to know what is the last item selected (not unselected) in a
list box.
(each time I am selecting a new item)
Many thanks.
M
 
D

Douglas J. Steele

Last as bottom-most in the list, or last as in most recently selected?

For the former, you need to loop through all of the items in the list to see
whether they're selected

For intCurrentRow = 0 To ctlSource.Listcount - 1
If ctlSource.Selected(intCurrentRow) Then
LastSelected = ctlSource.Column(0, intCurrentRow)
End If
Next intCurrentRow

or you can use the list box's ItemsSelected collection.

For the latter, I don't believe Access keeps any information about the order
in which they were selected, so you'd have to do that yourself.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top