Ms Access MultiSelect List box as Query Parameter

I have a MultiSelect listbox control on my form. I want to pass the selected items to a query as a parameter. Any ideas? A2003
Who is Participating?
Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:
Here is a popular link:

Note that you will have to adjust your code to trim the SQL string to your specific length, do this before the "Trim" line of code:
    msgbox strSQL
...Or create a textbox to display strSQL, then do this:
...or do this so you can see strSQL in the immediate window in the VBA Editor
    debug.print strSQL

You can also use the "IN()" SQL keyword to shorten the SQL

Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:
Also note here that it is much easier to pass the listbox selections to a Form or Report as the recordsource.

This way you can control what the user can and cannot do with the results:
Sample attached
Blueice13085Author Commented:
Thank you, fast answers
Jeffrey CoachmanMIS LiasonCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.