Query from multiselect in a listbox

N

Nikky_Pickles

I have set the multiselect property in the list box to simple and I want to
be able to run a query based on the selections made. I'm not sure I
understand all the code to use - as I have copy-pasted the example in the
help file (changing the references as appropriate of course!) and it doesn't
work. Can anybody provide an idiot-proof answer?
 
N

Nikky_Pickles

Actually, is it possible to show the results in a query, rather than a
report? We need to export the results to an excel spreadsheet.
 
A

Allen Browne

I guess you could generate the SQL statement in your code, and then assign
it to the SQL property of the QueryDef

strSQL = "SELECT ...
CurrentDb.QueryDefs("MyQuery").SQL = strSQL
 
N

Nikky_Pickles

Thanks - I'll give it a try

Allen Browne said:
I guess you could generate the SQL statement in your code, and then assign
it to the SQL property of the QueryDef

strSQL = "SELECT ...
CurrentDb.QueryDefs("MyQuery").SQL = strSQL
 
Top