multiselect list box last selected

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
Back
Top