I had the following bit of code in a project I'm working on that worked fine, until another user in these forumns asked about removing items from a listbox, then I modified my form to do this, and it only removes the first item selected.
basically, I have 2 list boxes. The first has an unfiltered list, the 2nd listbox I want to fill with items that I have selected in the 1st list box. This was working fine, even with multi-select chosen. But when I add the removeitem line of code, now it only does the very first item selected then stops!
Any ideas?
basically, I have 2 list boxes. The first has an unfiltered list, the 2nd listbox I want to fill with items that I have selected in the 1st list box. This was working fine, even with multi-select chosen. But when I add the removeitem line of code, now it only does the very first item selected then stops!
Any ideas?
Code:
For Each varItem In Me.lst_Files.ItemsSelected
Me.lst_Holdings.AddItem Item:=Me.lst_Files.ItemData(varItem)
Me.lst_Files.RemoveItem Me.lst_Files.ItemData(varItem)
Next varItem