Pivot table vba from access

Dharmesh

Registered User.
Local time
Today, 20:49
Joined
Dec 7, 2006
Messages
25
Hello

I have written some coding in access, which creates an excel file and exports data to it. I want to create a pivot table based on this. there seems to be a problem with part of my coding in creating a pivot table. can anyone help.

Attached is my code.

Thanks

Dharmesh
 

Attachments

Why not export a pivot table straigt from access instead of creating a pivot in Excel?

"there seems to be a problem" => What, Where, When???
 
Hello

Thanks for that:

'select query
Set db = CurrentDb
sSQL = db.QueryDefs("Hanging_MR").SQL
Set rs = db.OpenRecordset(sSQL)

For i = 1 To rs.Fields.Count
mySheet.Cells(1, i).Value = rs.Fields(i - 1).Name
Next i

mySheet.Cells(2, 1).CopyFromRecordset rs


Thats the code to select as a query, what is the definition to select it as a pivot table in access or as a pivot chart.

Thanks

Dharmesh
 
Simply create the pivot query in Access first, then pull that over much exactly the same as you are doing now :)
 

Users who are viewing this thread

Back
Top Bottom