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
--
Message posted via http://www.accessmonster.com
|
|
0
|
|
|
|
Reply
|
Barkley
|
10/22/2007 12:22:44 AM |
|
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
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Barkley via AccessMonster.com" <u38398@uwe> wrote in message
news:7a0bbdf0ed925@uwe...
> 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
|
|
0
|
|
|
|
Reply
|
Allen
|
10/22/2007 2:11:37 AM
|
|