LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default SQL Query Destination as an array varable


I know how to get the results for a SQL query into a sheet like this:

ActiveSheet.QueryTables.Add(Connection:=connstring ,
Destination:=Range("A1"), Sql:=sqlstring).Refresh

I need my code for the SQL query to put the results into an array
varable (or something like that) that I can refrence.

My goal in all of this is to run a second query and loop through each
instance of the 1st query without having to put the 1st query results
on a sheet and then iterating through it.

The best way to describe what I'm doing is I want to 1st query the list
of sales people in a table and then run a 2nd query that will give me
the sales data for each of the sales people and put that info into the
workbook.

If I can get this to work, we can add sales people to the database and
I won't have to revist my code.

If my approach is wrong please help me.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a lookup table with an added varable? GIZZMO Excel Worksheet Functions 3 April 6th 09 10:32 PM
Error: Number of query values and destination fields are not the s Secret Squirrel Excel Worksheet Functions 0 December 3rd 05 02:26 AM
How can I assign a varable to equal an array? (it allready has a name) hamma_thrower Excel Programming 4 September 6th 05 03:09 PM
Query for data in an array anonymous Excel Programming 2 January 13th 04 12:51 PM
Range as varable Rod Taylor Excel Programming 2 July 28th 03 01:41 AM


All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"