Re: Amend SQL Query with VBA
- From: "NickHK" <TungCheWah@xxxxxxxxxxx>
- Date: Tue, 3 Apr 2007 18:01:33 +0800
Given the complexity of the queries, if supported by the DB Engine, use a
stored procedure and pass the dates as parameters.
Using ADO, it would be pretty straight forward.
NickHK
"mr tom" <mr-tom at mr-tom.co.uk.(donotspam)> wrote in message
news:DD3E461A-9853-4D7C-B888-77B3BBD0C73E@xxxxxxxxxxxxxxxx
I've got a SQL query in an Excel spreadsheet.
Unfortunately, three lines are time dependent and need to be updated on a
monthly basis.
The query follows:
/*************/
select Sub.AdviserDisplay,
sum(Sub.YTDExistingClients) as YTDExistingClients,
sum(Sub.YTDNewClients) as YTDNewClients,
sum(Sub.YTDAllClients) as YTDAllClients,
------------- SQL CUT ----------
order by Sub.AdviserDisplay
/***************/
Date entries such as 200701 (Jan 2007) would need to be adjusted.
As there are a lot of these and it would be easy to get wrong, I'd like to
automate update of these.
Can I use VBA or a similar tool for this purpose.
Let's say the dates required are currently sat in cells somewhere in the
workbook - for the sake of the example, Master!A1, B1 etc.
Thanks for any guidance or suggestions you can provide.
Cheers,
Tom.
.
- Follow-Ups:
- Re: Amend SQL Query with VBA
- From: mr tom
- Re: Amend SQL Query with VBA
- References:
- Amend SQL Query with VBA
- From: mr tom
- Amend SQL Query with VBA
- Prev by Date: Re: Share and Protect question
- Next by Date: Re: Amend SQL Query with VBA
- Previous by thread: Amend SQL Query with VBA
- Next by thread: Re: Amend SQL Query with VBA
- Index(es):
Relevant Pages
|