I've been trying to use a list box to for a parameter query and I'm having no luck.
I gather the selected listbox items into a string.
Private Sub lstCrafts_LostFocus()
Dim cnt As Integer
Dim varItem As Variant
strSelected = ""
Result = ""
For Each varItem In lstCrafts.ItemsSelected
If strSelected = "" Then
strSelected = lstCrafts.Column(1, varItem)
Else
strSelected = strSelected & " OR " & lstCrafts.Column(1, varItem)
End If
Result = strSelected
Next varItem
End Sub
and in my query I call a function to return the string. I launch the query with a button using the macro function.
Function Selected()
Selected = strSelected
End Function
if I have a single item selected it works fine but as soon as its an or situation it fails to find anything. my string appears to be fine but its not interepreted correctly somehow. would love to know what I"m doing wrong.