Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default pivot table by useing Oracle view

hi sir,
am useing below this code to collect data in exel sheet then i am creating
pivot table using that data.
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim col As Integer
Dim row As Integer
Dim str1 As String
end1 = Cells(1, 26)

Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset

cn.Open ( _
"User ID=sujatas" & _
";Password=ss" & _
";Data Source=mdlp" & _
";Provider=MSDAORA.1")

rs.Open "SELECT to_char(INSdate,'MON-YY') MONTH,to_char(INSdate,'YYYY')" & _
"CYEAR,insdate,RATE_TYPE,PRIPUB,REGION1,PRIPROCTG1 ,SUM(AMOUNT)
AMT,SUM(TOTCC) CC FROM AD_CLIENT_MAP where INSDate between '01-FEB-09' AND
'28-FEB-09' GROUP BY INSdate,RATE_TYPE,PRIPUB,REGION1,PRIPROCTG1 UNION SELECT
to_char(INSdate,'MON-YY') MONTH,to_char(INSdate,'YYYY')
CYEAR,insdate,RATE_TYPE,PRIPUB,REGION1,PRIPROCTG1, SUM(AMOUNT) AMT,SUM(TOTCC)
CC FROM AD_CLIENT_MAP where INSDate between '01-FEB-08' AND '" & end1 & "'
GROUP BY INSdate,RATE_TYPE,PRIPUB,REGION1,PRIPROCTG1", cn
col = 0

' First Row: names of columns
Do While col < rs.Fields.Count
Cells(1, col + 1) = rs.Fields(col).Name
col = col + 1
Loop

' Now actual data as fetched from select statement

row = 1
Do While Not rs.EOF
row = row + 1
col = 0

Do While col < rs.Fields.Count
Cells(row, col + 1) = rs.Fields(col).Value
col = col + 1
Loop
rs.MoveNext
Loop

End Sub

sir i want directly that data or record set goes to pivot table

thanks and regards
amaya


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
View/Change Pivot Table Query ToniS Charts and Charting in Excel 5 November 13th 08 01:31 PM
View Pivot Table Source Data Mistermonday Excel Discussion (Misc queries) 2 October 27th 07 10:53 PM
Pivot Table, MS Query and Oracle Monika Excel Discussion (Misc queries) 2 March 29th 06 02:16 PM
How to view summarized items in a pivot table exceluser New Users to Excel 2 June 14th 05 03:10 AM
How do I go from "Chart View" to "Pivot Table Form" in a Pivot ta. Jersey Girl Excel Discussion (Misc queries) 1 March 10th 05 04:20 AM


All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"