multiselect listbox to use as criteria in a query

G

Guest

Hi,

I have a list box in a form, where users can select one or more
(Multiselect) Machines from a list. I want to use the selected Machines as
Criteria in a query (Machine1 OR Machine2 OR Machine3 etcetera) and have it
shown as Pivot in the subform.
It all works, but...... after requery (Me!SubFormPivot.Requery) only the
last selected Machine is used in the query, not all selected Machines.

Anybody a suggestion?

Regards,

Daan

BTW: Please do not reply by Email, I do not read mails send to this address.
 
A

Allen Browne

The Expression Service will not be able to handle the ItemsSelected
collection from a multi-select list box, and apply them to the criteria of
the query for you.

You could work around that issue by programmaticially creating the complete
SQL statement, and assigning it to the subform's RecordSource.

For an example of how to loop through the ItemsSelected and build up the
WHERE clause for your SQL string, see:
http://allenbrowne.com/ser-50.html
 
G

Guest

I am not looking forward to the programming, but I will give it a try, thanks
for the quick reply!
Daan
 

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