This should be easy but I cannot find anything on my following problem.
I am creating a query to select records based on what users select from a list box. Here is my code:
For Each intIndex In lstLongJobs.ItemsSelected
If Counter = 0 Then
strWhere = "Where tbl_Temp_Opts_Tape.Tape_Number = '" & lstLongJobs.Column(0) & "' "
Else
strWhere = strWhere & " Or tbl_Temp_Opts_Tape.Tape_Number = '" & lstLongJobs.Column(0) & "' "
End If
Counter = Counter + 1
Next intIndex
My problem is, if I select more than one item from the list box, the code above runs through the correct amount of times, but only pulls out the current selected record. So if I select two items, and I click on the 2nd item last, it will run the the code above 2 times (correct) but the value for lstLongJobs.Column(0) remains the last item I selected, instead of each item I select.
If anyone has run into this problem or knows of a fix let me know. Thank you for your time.
T.J.
I am creating a query to select records based on what users select from a list box. Here is my code:
For Each intIndex In lstLongJobs.ItemsSelected
If Counter = 0 Then
strWhere = "Where tbl_Temp_Opts_Tape.Tape_Number = '" & lstLongJobs.Column(0) & "' "
Else
strWhere = strWhere & " Or tbl_Temp_Opts_Tape.Tape_Number = '" & lstLongJobs.Column(0) & "' "
End If
Counter = Counter + 1
Next intIndex
My problem is, if I select more than one item from the list box, the code above runs through the correct amount of times, but only pulls out the current selected record. So if I select two items, and I click on the 2nd item last, it will run the the code above 2 times (correct) but the value for lstLongJobs.Column(0) remains the last item I selected, instead of each item I select.
If anyone has run into this problem or knows of a fix let me know. Thank you for your time.
T.J.