ACC2: Grouped Subreport Prints Each Record on a New Page

ID: Q125771


The information in this article applies to:


SYMPTOMS

Novice: Requires knowledge of the user interface on single-user computers.

When you print or preview a report that contains a subreport, the first page is correct but subsequent pages each contain only one line of data from the subreport. The subreport is grouped with the group's ForceNewPage property set to either BeforeSection or AfterSection.


RESOLUTION

To correct this problem, create the same type of grouping in the main report and control the new pages from the main report rather than the subreport. For an example of how to use this solution, follow the steps in the "Steps to Reproduce Problem" and "Steps to Correct Problem" sections later in this article.


STATUS

Microsoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access version 7.0.


MORE INFORMATION

Steps to Reproduce Problem


  1. Open the sample database NWIND.MDB.


  2. Create a blank new report based on the Products table.


  3. From the View menu, choose Sorting And Grouping. In the first Field/Expression cell, select Category ID. Set the group's GroupHeader property to Yes and then close the Sorting And Grouping dialog box.


  4. Add a text box with the following properties to the Category ID header section:
    
           Name: Category ID
           ControlSource: Category ID 


  5. Add a text box with the following properties to the detail section:
    
           Name: Product Name
           ControlSource: Product Name 


  6. Select the Category ID header section and then set its ForceNewPage property to BeforeSection.


  7. From the Format menu, choose Page Header/Footer to remove the page header and footer.


  8. Preview the report. Note that there is a new page for each Category ID.


  9. Save the report as Report1 and then close it.


  10. Create a blank new report that is not based on any table or query.


  11. Drag the Report1 report from the Database window to the detail section of the blank new report.


  12. Save the report as Report2.


  13. Preview the report. Note that the first page is correct, but subsequent pages each contain only one line of data.


Steps to Correct Problem


  1. View the Report2 report (the main report) in Design view. Set the report's RecordSource property to the Categories table.


  2. Set the subreport control's LinkMasterFields and LinkChildFields properties to Category ID.


  3. Set the detail section's ForceNewPage property to BeforeSection.


  4. Double-click the subreport control to open the subreport. Select the Category ID header section and set its ForceNewPage property to None.


  5. Save the subreport and then close it.


  6. Save the main report and then close it.


  7. Preview the main report (Report2). Note that there is one page for each Category ID.



Keywords          : kbusage RptSub 
Version           : 2.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: April 9, 1999