Microsoft KB Archive/299042

= ACC2002: Subform in PivotTable or PivotChart View Is Printed in Datasheet View =

Article ID: 299042

Article Last Modified on 9/26/2003

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q299042



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SYMPTOMS
When you print preview or print a form that contains a subform in PivotTable or PivotChart view, the subform is displayed or printed in Datasheet view.



CAUSE
The SourceObject of the subform is set to a table or a query whose DefaultView property is set to Datasheet.



RESOLUTION
There are two possible resolutions for this problem. You can either set the DefaultView property of the table or the query to the appropriate view, or you can change the SourceObject property of the subform to reference a saved form.

Setting the DefaultView Property of the Table/Query
One solution to the problem is to set the DefaultView property of the table to either PivotTable or PivotChart, depending on the view that you want the subform to be displayed in. This causes the subform to be displayed in PivotTable or PivotChart view during print preview and printing. To set the DefaultView property, follow these steps:
 * 1) Open the table in Design view.
 * 2) On the View menu, click Properties to view the property sheet for the table.
 * 3) Set the DefaultView property to PivotTable or PivotChart.
 * 4) Close the table, and then click Yes when Microsoft Access prompts you to save.

Setting the SourceObject of a Subform to a Saved Form
Another solution to the problem is to create a form that is based on the table or the query that serves as the subform, and then to set the SourceObject property of the subform to the new form. To set the SourceObject property of a subform, follow these steps:
 * 1) Create a new form that is based on the table or query currently serving as the subform.
 * 2) Add all fields to the form.
 * 3) Close the form, and then save it when you are prompted by Microsoft Access.
 * 4) Open the main form in Design view.
 * 5) On the View menu, click Properties to open a property sheet.
 * 6) Click the subform control to view its properties in the property sheet.
 * 7) On the Data tab, set the SourceObject property to the form that you created in step 3.



STATUS
Microsoft has confirmed that this is a problem in Microsoft Access.



Steps to Reproduce the Behavior

 * 1) Open the sample database Northwind.mdb.
 * 2) Open the Orders table in Datasheet view.
 * 3) On the View menu, click PivotTable View.
 * 4) In the PivotTable field list, click the CustomerID field.
 * 5) In the drop-down box at the bottom of the field list, click Row Area, and then click Add To.
 * 6) In the PivotTable field list, click the ShipVia field.
 * 7) In the drop-down box at the bottom of the field list, click Column Area, and then click Add To.
 * 8) In the PivotTable field list, click the Freight field.
 * 9) In the drop-down box at the bottom of the field list, click Data Area, and then click Add To.

Note that the PivotTable list displays the Sum of Freight per customer per shipper.
 * 1) Close the table, and then click Yes when Microsoft Access prompts you to save the changes.
 * 2) Click the Customers table in the Database window.
 * 3) On the Insert menu, click AutoForm. Note that Microsoft Access creates a form that is based on the Customers table, and that it includes a subform that is based on the Orders table.
 * 4) Click into any field in the subform.
 * 5) On the View menu, point to Subform, and then click PivotTable. Note that Microsoft Access displays the subform in PivotTable view.
 * 6) On the File menu, click Print Preview.

Note that the subform is displayed in Datasheet view.

Additional query words: pra

Keywords: kbbug kbnofix KB299042

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.