Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ADO Refresh (03)

    I am using ADO in Excel to extract information from Access. I can do the extracts without any issues. My question: Is it possible to place periods in separate columns instead of one?

    Example of Extract:
    <table border=1><td>Account</td><td>Period</td><td>Amount</td><td>SomeAcct</td><td>Actual</td><td>100</td><td>SomeAcct</td><td>Fcst</td><td>150</td><td>SomeAcct</td><td>LastYr</td><td>200</td></table>

    What I would like to see:
    <table border=1><td>Account</td><td>Actual</td><td>Fcst</td><td>LastYr</td><td>SomeAcct</td><td>100</td><td>150</td><td>200</td></table>


    Thanks,
    John

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: ADO Refresh (03)

    You could take the ADO output and make a pivot table from it. Account as the row field, period as the column, amount as the data field...

    Steve

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: ADO Refresh (03)

    You need a crosstab query for this. Something like
    <code>
    Dim strSQL As String
    strSQL = "TRANSFORM Sum([Amount]) AS S " & _
    "SELECT [Account] FROM [tblOrders] GROUP BY [Account] " & _
    "PIVOT [Period]"
    </code>
    Use this SQL string for the recordset. You'll have to use the actual field and table names.

Posting Permissions

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