Microsoft KB Archive/96586

{|
 * width="100%"|

PRA: Orders Form Doesn't Print/Preview SubTotal & Total
'Article ID: Q96586

Creation Date: 22-MAR-1993

Revision Date: 19-SEP-1996' The information in this article applies to:


 * Microsoft Access version 1.0

SYMPTOMS

You have a main form and a subform, and in the subform you have a control that uses an aggregate function, such as Sum, to calculate a value. On the main form, you have a control set to this subform control. When the main form is displayed in Form view, the control on the main form displays the correct value. However, when you switch the main form to Print or Print Preview, this control is blank.

For example, look at the Orders form included in the sample database NWIND.MDB. Note the Subtotal and Total fields. In Form view, these fields display values. When you switch to Print Preview, these values do not appear.

CAUSE

If the subform is displayed in Datasheet view, any main form controls that refer to aggregate calculated subform controls do not get repainted.

RESOLUTION

Display the subform as a continuous form, or use a domain aggregate function in the subform control. (See below for more information on these workarounds.)

STATUS

Microsoft has confirmed this to be a problem in Microsoft Access version 1.0. This problem was corrected in Microsoft Access version 1.1.

MORE INFORMATION

To work around this problem, you can either use a continuous form instead of a datasheet in the subform, or replace the aggregate function with a domain aggregate function in the subform control.

In the form named Orders Subform, a text box control named Order Subtotal is calculated by using the following aggregate expression:

=Sum([Extended Price]) On the form named Orders, the Subtotal control refers to this calculated subform control. The Orders form displays the Subtotal value but does not display the value in Print Preview. Workaround 1

 Open the Orders Subform in Design view and change the ViewsAllowed property to Both and the DefaultView property to Continuous Forms. Close and save the Orders Subform.  Open the Orders form. Note that the Subtotal and Total fields are correct. Switch to Print Preview and these amounts are now displayed. Note: You will probably want to rearrange the detail section of Orders Subform so it displays properly in the Orders form. 

Workaround 2

 Open the Orders Subform in Design view.  Change the text box control named Order Subtotal to the following: Note: In the following example, an underscore _ is used as a line continuation character. Remove the underscore when re-creating this example in Access Basic. Object: text box ControlName: Order Subtotal ControlSource: =DSum(&quot;[Extended Price]&quot;,&quot;[Order Details2]&quot;, _                        &quot;[Order ID]=Forms![Orders].[Order ID]&quot;)  Close and save the form. Open the Orders form in Form view.</li></ol>

Note how the Subtotal and the Total controls display the correct values in both Form view and Print Preview.
 * }

-

"THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY." '' ©1997 Microsoft Corporation. All rights reserved. Legal Notices.

''

Additional reference words: 1.00

KBCategory: kbusage

KBSubcategory: FmsSubf