Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How would I automate Access PivotTable results?

Status
Not open for further replies.

mlrmlr

Technical User
Mar 17, 2006
168
US
Hi,

How can I automate the results of an Access (2003)PivotTable and export the results to a particular spreadsheet?

Much appreciated.
 
Seek help on using the Excel Object in vba. This way you can open the Pivot table and refresh the data after you export, then close it so when the users open it they see the new pivot tables.

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Dim sql, strQry As String
Dim qdf As QueryDef
Dim fileN As String

strQry = "YourCrossTabQueryName"
Set qdf = CurrentDb.QueryDefs(strQry)
DoCmd.SetWarnings False
sql = write here the query (Select..... Pivot..)
qdf.sql = sql
fileN = the path of the Excel file
DoCmd.TransferSpreadsheet acExport, 8, strQry, fileN, True
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top