G
Guest
Is there a way to reference the last selected item in a list box?
For example... If I have a multiselect list box with three items selected
(Apples, Bananas, and Oranges respectively) Is there a way I can reference
the last selected item ( In this case being Oranges)?
The reason for this is regarding my last post, I was trying to create a SQL
Statement using a for loop so it would look something like:
For Each varItem In lstProgCode.ItemsSelected
strProgCode = "'" & lst.Column(1, varItem) & "'"
If the item selected is not the last item then
strSQL = strSQL & " & strProgCode & " & "Or "
Else
strSQL = strSQL & " & strProgCode & "
Next varItem
strSQL = "SELECT * FROM tblTable1 WHERE Table1.ProgCode = " & strSQL & "
I know this needs a little work but any help would be greatly appreciated.
Thanks,
Chad
For example... If I have a multiselect list box with three items selected
(Apples, Bananas, and Oranges respectively) Is there a way I can reference
the last selected item ( In this case being Oranges)?
The reason for this is regarding my last post, I was trying to create a SQL
Statement using a for loop so it would look something like:
For Each varItem In lstProgCode.ItemsSelected
strProgCode = "'" & lst.Column(1, varItem) & "'"
If the item selected is not the last item then
strSQL = strSQL & " & strProgCode & " & "Or "
Else
strSQL = strSQL & " & strProgCode & "
Next varItem
strSQL = "SELECT * FROM tblTable1 WHERE Table1.ProgCode = " & strSQL & "
I know this needs a little work but any help would be greatly appreciated.
Thanks,
Chad