Re: Amend SQL Query with VBA

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.


.



Relevant Pages

  • Re: DAO to ADO and stored procs
    ... But what I don't understand is, why with the same DB engine do we have some errors on some 'complicated' queries? ... These queries are all working well in MSAcess itself and also with DAO, but hangs with ADO!! ... My experience is that with an Access DB, ADO is quite a bit slower. ...
    (borland.public.delphi.database.ado)
  • Re: ADO vs DAO vs ADODB
    ... ADODB is simply a object reference to the ADO library. ... ms-access is a developers tool, like VB, or C++. ... server, oracle, or the default "file based" JET data engine. ... The mdb file format is based on the JET database engine. ...
    (microsoft.public.access.formscoding)
  • Desperate for help on serious TCP/IP connectivity problem
    ... MSDE either SP2 or SP3a) via TCP/IP under ADO results in queries being ... the connection to the database is made via TCP/IP ... We suspect that deep in the TCP/IP stack something is pumping messages, ...
    (microsoft.public.sqlserver)
  • ANN: SMExport suite v4.77 for Delphi/C++Builder
    ... - new export engine for ADO datasource ... SMExport for Delphi&C++Builder is a native VCL component suite for data ... - DIF (Data Interchange Format) ... SMExport is a native VCL engine with multi-language support. ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: composite key question
    ... Each time you do an insert SQL ... it's probably not a stored procedure. ... queries to perform slower, however. ... Seeing as how that script you sent was not a stored proc, ...
    (microsoft.public.sqlserver.programming)