vbasql_jack
New Member
- Joined
- Sep 14, 2016
- Messages
- 2
Hello
I have written multiple SQL queries such as:
begin
'select sales from data_table where year = 2016'
'select revenue from _reports where year = 2016'
..etc
end
When I run this query from top to bottom in SQL Server, I get a table result for each query, which is great.
However, the problem is when I am trying to run this full query through VBA, only the first table pulls through using:
range("A1").copyfromrecordset rs
How can I set up my VBA code to loop through the tables after the query has ran in VBA and pull the data from each table?
My workaround is to split out the SQL queries and run them individually. But I feel this slows down the process.
I have written multiple SQL queries such as:
begin
'select sales from data_table where year = 2016'
'select revenue from _reports where year = 2016'
..etc
end
When I run this query from top to bottom in SQL Server, I get a table result for each query, which is great.
However, the problem is when I am trying to run this full query through VBA, only the first table pulls through using:
range("A1").copyfromrecordset rs
How can I set up my VBA code to loop through the tables after the query has ran in VBA and pull the data from each table?
My workaround is to split out the SQL queries and run them individually. But I feel this slows down the process.