Changing pivot table ADO recordset

M

marwan.hefnawy

Hi fellows,
I've created a pivot table from an ADO recordset. (No problem in that)
like in this code:

Dim rs As New ADODB.Recordset
rs.open ........
Dim pc As PivotCache
Set PC=ThisWorkbook.PivotCaches.Create(....)
Set pc.Recordset = rs
pc.CreatePivotTable(...)


The problem is:
If the source data has changed and I want to transfer these updates to the pivot table (and its pivot cache).
How can I tell the pivot table (or its pivot cache) to use another updated ADO recordset?

I do not want to re-construct a new pivot table each time there are changes in the source data, Just updating the data (or the recordset) in the first pivot table.

Also I do not want the trivial solution that is pasting the recordset contents into a worksheet using rs.CopyFromRecordset and then use the pasted range as a source for a permanent pivottable.
I just want to throw a new recordset into the pivot table (or its pivot cache) directly.

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top