I have a form with a list box, and the items selected from that list box are
used to add values to the WHERE clause of a query that is the data source
for a report. For each item chosen from the list box, the item is added to
a string, and that string becomes part of the WHERE clause. I need to
identify the first item chosen, since the string that it is put into is
slightly different than for the subsequent items. The problem I'm having is
figuring what to look at that tells me it is the first one.
I'm using the ItemsSelected collection, and my code I'm using to start out
is:
Dim frm As Form, ctl As Control
Dim varItm As Variant
Set frm = Forms!frmGCSBanksNotSurveyedReport
Set ctl = frm!lstHost
For Each varItm In ctl.ItemsSelected
Debug.Print "varItm = " & varItm
Next varItm
What happens is that for some reason varItm seems to be the index of the
chosen item in the original list box, not its index in the ItemsSelected
collection. What can I look at to determine the position of the item in the
ItemsSelected collection instead of the original list?
Thanks.
Steve