I use the code below to execute an event on the selected items in the listbox, however, it takes too long if too many items are in the listbox. The routine moves through each listbox item to check whether it is selected or not. I would like a routine that would capture only the selected items and not have to move through each list item to see whether it is selected.
''''''''''''''''''''''''
For i = 0 To List1.ListCount - 1
List1.ListIndex = i
sql = "select * from employee where company_id=" & Company_ID & _
"and [Full Name]='" & List1.List(List1.ListIndex) & "' order by employee.[Full Name]"
Set rsEE = dbPayroll.OpenRecordset(sql, dbOpenSnapshot)
If Not rs1.BOF Then
If List1.Selected(i) = True Then
<Statements>
End If
End If
Next i
'''''''''''''''''''''
Any ideas,
thank you
''''''''''''''''''''''''
For i = 0 To List1.ListCount - 1
List1.ListIndex = i
sql = "select * from employee where company_id=" & Company_ID & _
"and [Full Name]='" & List1.List(List1.ListIndex) & "' order by employee.[Full Name]"
Set rsEE = dbPayroll.OpenRecordset(sql, dbOpenSnapshot)
If Not rs1.BOF Then
If List1.Selected(i) = True Then
<Statements>
End If
End If
Next i
'''''''''''''''''''''
Any ideas,
thank you