Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiselect listbox - determining item just selected or deselected

Status
Not open for further replies.

mmorancbt

IS-IT--Management
Nov 11, 2002
367
US
I have a list box set as simple multiselect.

I would like to know, at the time a user clicks on an item, the item in the list that was just selected or deselected.

I don't see anyway to do this from the object's property values.

I would hate to have to iterate through the items each time a click occurs. Any ideas?

Matthew Moran (career blog and podcast below)
Career Advice with Attitude for the IT Pro
 
What do you want to do with the selections?
You must use code to distinguish which items were selected. like:
Dim stDocName As String
Dim frm As Form, ctl As Control
Dim varItm As Variant
Dim strList As String
strList = ""
Set frm = Forms![Multi_ParcelID_Form]
Set ctl = frm![parlist]
For Each varItm In ctl.ItemsSelected
strList = ctl.ItemData(varItm)
Forms![Multi_ParcelID_Form]("holdbox" & varItm).Value = strList
Next varItm
 
That is what I did.

Basically, as a user selects an item (each item selected), it rewrites a field. This requires that I iterate through every selected item (as you have shown).

I have one list that is 200 rows long and wanted to know specifically which row was selected or deselected on the most recent click.

Oh well. it works and is still fast.

Matthew Moran (career blog and podcast below)
Career Advice with Attitude for the IT Pro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top