criteria from multiselection

A

angie

i have a form with a multiselect list. i want my query to return records
based on the multiple selections. how can i achieve that?

i have tried [forms]![formname]![listname] but i get no data.
 
A

Allen Browne

You cannot directly use a multi-select list box like that in a query.

You will need to loop through the ItemsSelected collection of the listbox.
It is possible to write a function that accepts the field value and the list
box and returns True/False as to whether it was found, and use this function
in the WHERE clause of a query.

However, it's probably easier to build a Filter for your form or report from
the ItemsSelected. Here's an example of how to do that:
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