I'm using this code to pick out items on a list box and create a query. I've only put this bit of code because I think this is where the problem is (hopefully)
For Each varItem In Me.List0.ItemsSelected
sPerson = sPerson & Me.List0.ItemData(varItem)
Next varItem
sPerson = " [ID] in (" & sPerson & ")"
'SQL criteria
sCriteria = sPerson
This works fine if I choose just one item on the list. However, If I choose 3 items it doesn't show 3 records it just shows the one record. IE, if I choose ID 3,4, 6 it shows the single record for ID 346.
Any ideas gratefully received.
For Each varItem In Me.List0.ItemsSelected
sPerson = sPerson & Me.List0.ItemData(varItem)
Next varItem
sPerson = " [ID] in (" & sPerson & ")"
'SQL criteria
sCriteria = sPerson
This works fine if I choose just one item on the list. However, If I choose 3 items it doesn't show 3 records it just shows the one record. IE, if I choose ID 3,4, 6 it shows the single record for ID 346.
Any ideas gratefully received.