Further to my previous message, I have set up a list box to allow multiple selections. How can I use these multiple selections in a query to select rows based on each value. the syntax I have (... = [forms]![formname]![listboxname]..)does not seem to work.
Hi Ken,
You can't use the list box the way you have mentioned. You must iterate thru the ItemsSelected collection to get all the values.
You could write a public function as below:
Public Function getCriteria() as String
dim x as variant
dim str as string
str=""
For each x in [Forms]![yourFormName].List1.ItemsSelected
str=str & [Forms]![yourFormName].List1.Column(0,x)
Next x
getCriteria=str
End Sub
In the query criteria, you could use
In getCriteria()
I have not tried this code but hope this helps. Let me know what happens.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.