Code:
DoCmd.OpenForm stDocName, acFormPivotChart
I am using this statement to open a form in pivotchart view.

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?
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 !