oops I forgot there were multiple sections to this forum..not used to it.. =/
anyway heres what I posted in general:
If I use a listbox on a form as a criteria for a query. How will the query handle the multiple selections possible in a listbox?
Ideally it will filter based on all selections.
thank you
Rich_Lovina
02-11-2002, 03:17 AM
I think you are operating in reverse, in that your form is designed either on atable or a query.
You must make up the query first, and then in the list box or form itself, set it to that query.
Hope this helps...
nono let me better explain.
I have the form and everything created from this form I run reports and pass a few different values from the form to reports as SEARCH criteria.
does that clear it up at all?
Alexandre
02-11-2002, 01:27 PM
Basically, assuming that your listbox is Me.List:
Dim ConcatStr As String
Dim varItm As Variant
ConcatStr = "("
For Each varItm In Me.List.ItemsSelected
ConcatStr = ConcatStr & Me.List.ItemData(varItm) & ", "
Next varItm
If ConcatStr <> "(" Then
ConcatStr = left(ConcatStr, Len(ConcatStr) - 2) & ")"
Else
ConcatStr = ""
End If
You ll have to adapt that to your data type (for example for dates, you will need to surrond List.ItemData(varItm) with #...)
Alex
[This message has been edited by Alexandre (edited 02-11-2002).]