![]() |
Query using list of parameters
Is it possible to limit query results by a list of data or an aray rather
than a single parameter? |
Query using list of parameters
You may want to import the entire table into excel and then use Advance filters in Excel to filter the table. A query uses SQL language which Microsoft call the command Text part of 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 but somebody else may be able to answer that part of your question. A SQL statement can be very long and contain multiple WHERE phases. If you were to create your own SQL statement using a macro each entry in your Table would be another WHERE phase of the SQL. Instead of using a Query you can write a macro using the ADO method to get the data. The Query method has one advantage over the ADO method in that it will automatically refresh. You can achieve the same results using the ADO method by using a timer to automatically run a macro to 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 refresh 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 recordset method which will loop through every row of the table and then select the data you want like you would stepping through an excel Worksheet. There is very little differences between an excel spreadsheet and an access database table. All Microsoft Office programs use the same file structure which contains documents, tables charts, pictures, slides. An Excel worksheet is a table just like an access database table and all commands in VBA that you can use in a worksheet can also be used in a table.. You can even open an excel worksheet using the ADO method. The ADO method is sometimes useful on large Excel files becaue it doesn't open the file which uses a lot of memory and is slow. Instead you make a connection to the file. I hope I didn't confuse your too much. I'm not a mind reader and don't know exactly what you are trying to accomplish. if you have only 5 to 10 items in your table creating a SQL with multiple where statement might be the best method to use. You also can get the entire table and then write VBA code to filter the items use Advance filters which does have a table structure. -- joel ------------------------------------------------------------------------ joel's Profile: 229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=185278 Excel Live Chat |
All times are GMT +1. The time now is 06:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com