View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dan[_39_] Dan[_39_] is offline
external usenet poster
 
Posts: 2
Default VB macro code for SQL Query

Hello,

I am an experienced Excel user just starting to build VB
code/scripts. I'm trying to put a SQL query (from an ODBC
data source) into a macro, so that when it runs, it
returns the result set to a specified range in a worksheet
(i.e. Sheet2!A1).

The query is something like:

Select serialnum, count(serialnum)
from TicketGrids
where serialnum like sheet1!a2

and other queries are very complex involving inner joins,
full outer joins and views from the SQL database.

I am trying to automate a complex report where data is
currently manually imported.

Thanks in advance!

Dan