Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am querying my database and saving it to a recordset...see below...know how
do i put that into a pivot? I only know how to write the code for an XL based data source.. Thank you Sub GetAccessData() Dim sh As Worksheet Set sh = Sheets("Sheet2") Dim MyConnect As String Dim MyRecordset As ADODB.Recordset MyConnect = "Provider=Microsoft.ACE.OlEDB.12.0;" & _ "Data Source = C:\Dans_DB.accdb" Set MyRecordset = New ADODB.Recordset MyRecordset.Open "DMA", MyConnect, adOpenStatic, adLockReadOnly |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For create your pivot table you can do so:
With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExter nal) .Connection = "Provider=Microsoft.ACE.OlEDB.12.0;Data Source = C:\Dans_DB.accdb" .CommandType = xlCmdSql .CommandText = your_query .CreatePivotTable TableDestination:=Range("A3"), _ TableName:=your_pivot_name, DefaultVersion:=xlPivotTableVersion10 End With After for refresh your data: ActiveSheet.PivotTables(sNamePivot).PivotCache.Ref resh Bye, Ste' |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pivot Table and External Data | Excel Worksheet Functions | |||
Pivot Table from External Data? | Excel Discussion (Misc queries) | |||
Pivot table accessing external data | Excel Discussion (Misc queries) | |||
Setting external data location for a pivot table | Excel Programming | |||
Pivot table using External data | Excel Discussion (Misc queries) |