By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,805 Members | 1,202 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,805 IT Pros & Developers. It's quick & easy.

Pivot Command

P: 21
I was hoping someone might be capable to assist

I have a form called FrmEmployeeCountPivot

And on the above mentioned i have a subform called FrmEmployeeCountPivotSub

The Sub is a Pivot Table

What i am trying to achieve is normally i will click on my pivot table comandbar, on the export to excell. And will work perfectly.

Now Because the sub is on my main form my Pivot Commandbar, does not appear anymore.

I would like to place the command on my main form to allow the user the send the pivot to excell exactly as it happens if i click the send to excel command on my menu..

Is there a way that use the send to excel menu command just behind an normal cmdbutton on my form

I tried creating a macro that uses
Runcommand - PivotTableExportToExcel but only get an error, action failed
is there a way that i can make use of the command on my subform.

Thank you very much in advance for any help

Regards
Sep 24 '08 #1
Share this Question
Share on Google+
6 Replies


100+
P: 167
Here is the code that you can put in OnClick event of your button:

Expand|Select|Wrap|Line Numbers
  1. stDocName = "name of query here"
  2. DoCmd.OpenQuery stDocName, acViewPivotTable, acEdit
  3. DoCmd.RunCommand acCmdPivotTableExportToExcel
  4. DoCmd.Close acQuery, stDocName, acSaveNo
Sep 24 '08 #2

P: 21
HI

Thank you for the assistance.

I was wondering, this allows me to export the data in query view, and then to add it to the pivot. When it is in Excell

Is there a way to export the current pivot as it is in Access

Thank you in advance
Sep 25 '08 #3

100+
P: 167
Yes there is. Try something like:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.GoToControl "Subform Control Name Here"
  2. DoCmd.RunCommand acCmdPivotTableExportToExcel
Sep 25 '08 #4

P: 21
Brillinat

Thank you so much for the help..


Regards

Natural
Sep 29 '08 #5

P: 5
Sorry to ask a question since it wasn't my original post, but is there a way to specify the file path and file name for the pivot that was exported to Excel. The code works great to transfer for the pivot in it's designed format, but I still have to manually save the output after it's sent to Excel. Thanks.
Oct 29 '08 #6

Expert Mod 2.5K+
P: 2,545
Please do not hijack another poster's thread, or double-post your questions (see this thread). Thank you.

MODERATOR
Oct 29 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.