Query using list of parameters

K

Keith

Is it possible to limit query results by a list of data or an aray rather
than a single parameter?
 
J

joel

You may want to import the entire table into excel and then use Advanc
filters in Excel to filter the table.

A query uses SQL language which Microsoft call the command Text part o
the query. I'm not an expert on SQL but know a lot about SQL language.
I haven't seen any way of automatically getting data from a table bu
somebody else may be able to answer that part of your question.

A SQL statement can be very long and contain multiple WHERE phases. I
you were to create your own SQL statement using a macro each entry i
your Table would be another WHERE phase of the SQL.

Instead of using a Query you can write a macro using the ADO method t
get the data. The Query method has one advantage over the ADO method i
that it will automatically refresh. You can achieve the same result
using the ADO method by using a timer to automatically run a macro t
refresh your data.

So here are some of the choices you can do using VBA to get the data

1) Create a query with Multiple Where phases which will refres
automatically
2) Create a macro that uses the ADO method and run manually using SQL.
3) Use ADO method and don't create a query. You can use the recordse
method which will loop through every row of the table and then selec
the data you want like you would stepping through an excel Worksheet.


There is very little differences between an excel spreadsheet and a
access database table. All Microsoft Office programs use the same fil
structure which contains documents, tables charts, pictures, slides. A
Excel worksheet is a table just like an access database table and al
commands in VBA that you can use in a worksheet can also be used in
table.. You can even open an excel worksheet using the ADO method. Th
ADO method is sometimes useful on large Excel files becaue it doesn'
open the file which uses a lot of memory and is slow. Instead you mak
a connection to the file.

I hope I didn't confuse your too much. I'm not a mind reader and don'
know exactly what you are trying to accomplish. if you have only 5 t
10 items in your table creating a SQL with multiple where statemen
might be the best method to use. You also can get the entire table an
then write VBA code to filter the items use Advance filters which doe
have a table structure.
 
Top