Run SQL using parameters defined on Excel worksheet
Posted on 2005-02-24
I am currently designing a Excel spreadsheet that will display queries on an Access database. What I would like is the flexibilty of pasting in SQL direct from Access into a single Excel cell (forming a column of SQL) with the parameters needed to run the query and where to populate it to in the adjacent columns.
What I am having trouble in doing is finding creating a VB script that will run the SQL and parameters and populate the results in a specified sheet and cell. The idea being that the user is able to create new queries in Access, paste the SQL from it into the sheet, define the inputs (dates, names etc.), specify the sheet and cell the query is to populate and run this code.
The Database location will also be specified on the Excel sheet so the sheet can be pointed to (and run) on different databases or be cloned to other users.