ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   pivot table connection access (https://www.excelbanter.com/excel-programming/436770-pivot-table-connection-access.html)

vavasoo

pivot table connection access
 
hi

the following macro gets stuck where show below

Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
Dim pc As PivotCache
Dim pt As PivotTable

con.Open "provider=microsoft.jet.oledb.4.0;" & _
"data source=C:\Users\M Varnendra\Desktop\VBA on Excel\Chapter 22\salesdb.mdb"
sql = "select * from sales"

Set pc = ActiveWorkbook.PivotCaches.Add(SourceType:=xlExter nal)
Set pc.Recordset = rs

'''''getting stuck here
Worksheets.Add befo=Sheets(1)
Set pt = ActiveSheet.PivotTables.Add(PivotCache:=pc, _
tabledestination:=Range("a1"))

know about it?

thank

Varne

pivot table connection access
 
guys

whats up

rs.Open sql, con was missing. now its working



"vavasoo" wrote:

hi

the following macro gets stuck where show below

Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
Dim pc As PivotCache
Dim pt As PivotTable

con.Open "provider=microsoft.jet.oledb.4.0;" & _
"data source=C:\Users\M Varnendra\Desktop\VBA on Excel\Chapter 22\salesdb.mdb"
sql = "select * from sales"

Set pc = ActiveWorkbook.PivotCaches.Add(SourceType:=xlExter nal)
Set pc.Recordset = rs

'''''getting stuck here
Worksheets.Add befo=Sheets(1)
Set pt = ActiveSheet.PivotTables.Add(PivotCache:=pc, _
tabledestination:=Range("a1"))

know about it?

thank



All times are GMT +1. The time now is 10:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com