Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using SQL (with a Group by function) inside EXCEL VBA

Hi,
I have some data on a worksheet. I would like to use this data as input
into a SQL query (Select .... from Sheet1....group by....) and load the query
output on a different worksheet. How can I set up a Excel VBA macro with a
SQL that will allow me to do this?


--


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using SQL (with a Group by function) inside EXCEL VBA


It seem like you know SQL pretty well. You have afew choices.
Depending on the number of items you are returning your can setup a SQL
with multiple WHERE clauses to return all the items at one time or
retrieve the data multiple times with a single WBERE clause. there arre
two questions that need to be answered

1) Do you wnat to have the query automatically update?
2) Are the number of rows that are going to be returned each time the
data is retrieve the same number of rows or are the number of rows
returned going to be different each time the data is retrieved?

You can get data from a database using a query or opening the database
as a recordset like you would in Access. The recordset commands in
Excel VBA and Access VBA are the same as is probably the better method
is the number of rows going to be different each time the query is run.
the disadvantage with the recordset is you would have to manually run
the update or setup a timer to run the macro periodically. You can alos
use a workbook open event to retrieve the data as another option.

I think you need to think about which options you want before you ask
for the correct code to impliment the options you choose.


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=153331

Microsoft Office Help

Reply
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
Calculation Context available inside an Excel VBA function? David Boden Excel Programming 1 April 11th 08 05:13 PM
Using a range variable inside a excel function Michael Excel Discussion (Misc queries) 2 November 14th 05 02:52 PM
Selectig rows inside a group [email protected] Excel Programming 0 November 14th 05 02:46 PM
How do I group worksheets (Lotus 123 function is "Sheet>Group Shee jaking Excel Worksheet Functions 2 August 30th 05 02:09 PM
How do i group worksheets inside a workbook into subgroups? Legatha Excel Worksheet Functions 3 March 19th 05 01:51 AM


All times are GMT +1. The time now is 10:20 AM.

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"