Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Nov 2009
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi guys,
    I have a report that I've designed and am at the last step, but I just can't figure it out.
    As a rule, my report for each group is 1 page per master record. the detail section in that report consists primarily of a sub-report control (with a "can grow" property enabled) that contains child records related to the master record. This seems to me to be a very common report design.

    What I'm trying to do is stretch the detail section in the sub report based on a count of the number of records in the sub report for each grouped master record.

    Some sub reports have 30 records, and that fills the main report page nicely. Other reports have a sub report that contain 10 child records, and that leaves my main report with a large blank gap of white space. If I can stretch the detail section in the sub report based on a count, then for reports with low count, the white space would be distributed between the records, instead of clumped underneath the sub-report.

    Any help would be appreciated.

    Thanks in advance.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Try the following:

    Place a text box with control source =Count(*) in the subreport header. You can set its Visible property to No. Let's say that you name it txtCount.

    Create an event procedure for the On Format event of the Detail section of the subreport:

    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
      Me.Detail.Height = (8 * 1440) / Me.txtCount
    End Sub
    You'll have to experiment to get it right. The height is measured in twips, where 1 inch = 1440 twips. In the example code, the total vertical space available for the Detail sections is 8 inch (8 * 1440 twips). Change the number 8 to suit your situation.

  3. #3
    New Lounger
    Join Date
    Nov 2009
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hans,
    This worked out great. I also learned something from this.

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •