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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last value selected in a multi select list box 2

Status
Not open for further replies.

MajP

Technical User
Aug 27, 2005
9,382
US
I have a multi select list box. As user click a record I want to return data for that record. How do I return the last item selected (not the last item in the list)? I have come up with a solution, but it seems there has to be a better way. My solution is to build a collection of the old ItemsSelected. Then compare that collection to the new itemsSelected and return the different value.
 
If I am understanding what you are asking . . .
Could you declare a global variable in the form and then assign a value on the on-click method to this variable. This way it is updated and will always display the most recent item selected on the list.

Code:
       If Me.CustomerName.Selected(Me.CustomerName.ListIndex) = True Then ' test to determine if the current item was unselected
       MsgBox Me.CustomerName.ItemData(Me.CustomerName.ListIndex)
       End If

I just used a msgbox to test you could assign the variable instead.

ck1999
 
Thanks. I could not see the forest for the trees.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top