Query with parameters set to a List Box displaying multiple values

  • Thread starter Barkley via AccessMonster.com
  • Start date
B

Barkley via AccessMonster.com

I'm trying to set up a query with parameters set to a list box holding
multiple values... I have set a query with its parameters displaying single
values from a combo box before... does anyone know how I can set my
parameters to a list box displaying multiple values and have the query work?

Thanks
 
A

Allen Browne

The query cannot use the multi-select list box values directly.

It is possible to write a function that accepts a field (from the query) and
the list box (on the form), loops through the ItemsSelected in the list box,
and returns a True/False value. The query calls the function like this:
WHERE MyFunc([MyField], [Forms].[MyForm].[MyListbox])

Depending on where you plan to use the query, you might be better to omit
the criteria from the query, and instead create a string to use in the
Filter of a form, or the WhereCondition of OpenReport. There's an example of
how to take this approach here:
Use a multi-select list box to filter a report
at:
http://allenbrowne.com/ser-50.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top