How to open a report in Pivot chart view by default

baba

Registered User.
Local time
Today, 01:04
Joined
Nov 15, 2011
Messages
39
I like to open a report as a pivot chart from my query.
How to open a report by making the default view of report as pivot chart?.
I am able to manually create a pivot chart by clicking pivot chart view from the sql view in a report. Then I pull in the required columns to the x axis and y axis and a graph is generated. I do not know how to save it and open the report by default in pivot chart view every time I click a button .
 
Wouldn't that be a simple:
Code:
DoCmd.OpenReport "Report Name", [COLOR=Blue]acViewPivotChart[/COLOR]
?
 
Private Sub TestReport_Click()
DoCmd.OpenReport "Report38", acViewPivotChart
End Sub
Hi I tried to open report as advised and received the below error message:
Do I have to change any characterestics of the report that I am trying to open. Please help

Run-time error '2505':
An expression in argument 2 has an invalid value.
 
But are you sure the version of your database is Access 2007? Can you upload a sample? It seems I've asked this question twice in other posts ;)
 
Hi the code you provided works for forms but not for reports in Access 2007. My client does not allow me to upload my DB.

This opens the form in PivotChart mode ---
DoCmd.OpenForm stDocName, acFormPivotChart.


My question is: How to create Pivot chart with graphs populated from a query using vba .Could you please provide any sample vba code that runs a query ,creates a pivot chart in a form and then opens the form as a report on a button click. Thanks for your help !

Also, in the pivotchart view of the form,I dragged the columns that I needed for the graph and when I close the form and reopen the same form with a button click,the form opens up with empty barchart in pivotchart view. Is there a way to populate the graph based on the query while the form is opened in pivot chart view?
 
Last edited:
I can't tell you without seeing A db. I didn't say upload your client's db, I said you should upload a test db.
 

Users who are viewing this thread

Back
Top Bottom