ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sql (https://www.excelbanter.com/excel-programming/397441-sql.html)

JT

sql
 
I want to run a sql statement in Excel that will extract data from an Access
database. I have found this code but have a question. Value1, value2, etc.
are all part of an array. How would I modify this code to use the values in
the array? Depending on who is using it, the total number of items in the
array will change from person to person or from date to date. Thanks.......

Thanks....

SELECT column_name FROM table_name
WHERE column_name IN (value1,value2,..)
--
JT

Tim Williams

sql
 
SQL="SELECT column_name FROM table_name " & _
"WHERE column_name IN ('" & Join(arrCols,"','") & "')"

where arrCols is your array of column names.

Tim




"JT" wrote in message
...
I want to run a sql statement in Excel that will extract data from an
Access
database. I have found this code but have a question. Value1, value2,
etc.
are all part of an array. How would I modify this code to use the values
in
the array? Depending on who is using it, the total number of items in the
array will change from person to person or from date to date.
Thanks.......

Thanks....

SELECT column_name FROM table_name
WHERE column_name IN (value1,value2,..)
--
JT





All times are GMT +1. The time now is 12:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com