+ Reply to Thread
Results 1 to 4 of 4

Perform SQL command on Disconnected ADO Recordset

  1. #1
    R Avery
    Guest

    Perform SQL command on Disconnected ADO Recordset

    I have an ADO recordset that I created by declaring it as new and
    adding all of the columns and data manually. I want to be able to
    perform a SQL string on it to do aggregation and other things that SQL
    provides. Is there anyway to do this?


  2. #2
    K Dales
    Guest

    RE: Perform SQL command on Disconnected ADO Recordset

    A recordset is the result of a query, so you can't really query it. You will
    need to use code to extract the values you need (or to step through and
    calculate your aggregates). This is a bit of a hassle, but not too bad. The
    Filter property can help here, as well as the Find method. Then a simple
    loop through the recordset can retrieve or add or otherwise manipulate the
    values.

    "R Avery" wrote:

    > I have an ADO recordset that I created by declaring it as new and
    > adding all of the columns and data manually. I want to be able to
    > perform a SQL string on it to do aggregation and other things that SQL
    > provides. Is there anyway to do this?
    >
    >


  3. #3
    Robin Hammond
    Guest

    Re: Perform SQL command on Disconnected ADO Recordset

    I tend to use ADO against a database connection, but I believe that you can
    also use it to query a closed workbook, so

    1. where is the data coming from? if from a workbook in a reasonable data
    structure, you could just query the closed workbook.
    2. if not, you could use copyfromrecordset to put the data in a workbook,
    save the book, then query the book.

    I don't have time to work up an example right now I'm afraid, but the
    suggestion might get you headed in the right direction.

    Robin Hammond
    www.enhanceddatasystems.com


    "K Dales" <[email protected]> wrote in message
    news:[email protected]...
    >A recordset is the result of a query, so you can't really query it. You
    >will
    > need to use code to extract the values you need (or to step through and
    > calculate your aggregates). This is a bit of a hassle, but not too bad.
    > The
    > Filter property can help here, as well as the Find method. Then a simple
    > loop through the recordset can retrieve or add or otherwise manipulate the
    > values.
    >
    > "R Avery" wrote:
    >
    >> I have an ADO recordset that I created by declaring it as new and
    >> adding all of the columns and data manually. I want to be able to
    >> perform a SQL string on it to do aggregation and other things that SQL
    >> provides. Is there anyway to do this?
    >>
    >>




  4. #4
    R Avery
    Guest

    Re: Perform SQL command on Disconnected ADO Recordset

    The data is coming from an open workbook, and the range i want to get
    it from can start with any upperleft cell. The purpose of this is to
    have all data centralized in a single place, and just create random
    QueryRange() views on different worksheets.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1