multi-select list box

  • Thread starter Thread starter MSD
  • Start date Start date
M

MSD

I am running a report that uses a form to collect beginning and ending item
numbers and uses a query as its record source. This works, but now I would
like to use a list box to feed multiple item numbers to the query.

This means I need to put something in the criteria cell of my query, like
'IN (100,105,110)'. That would work, except I want the item numbers to come
from the list box.

What do I need to put in my query's criteria for itemNo? Do I need to loop
through the collection - but what do I do with the result?

Thanks,

Emma
 
Dear Emma:

Writing code to iterate through the selected items in a multi-select
list box is one of the ways to do it. You use this to build the SQL
string for the query, then you can execute that query string.

If you require this to run off a saved query, you can also iterate
through the list, adding the values to a local table. Joining that
local table to a saved query will also work. This has a possible
advantage of never exceeding the query string length limit.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Back
Top