Using MoveLayout to print subtotal on last detail line of group

  • Thread starter Thread starter Tony M
  • Start date Start date
T

Tony M

Hi all. I am trying to get a report to print subtotals on the same
line as the last detail line of a section, for example:

Section Boxes Total
A 10
A 22 32
B 35
B 38
B 10 83
C 44 44
D 10
D 10 20

My report has a detail section and a group footer section, with the
group footer section having the total of boxes.

From my understanding of this page:

http://msdn.microsoft.com/en-us/library/aa195329(office.10).aspx

setting MoveLayout to False in the Format event of a section will
cause the section to "Print the current record on top of the last
record as an overlay." Yet, my totals are overlaid one line too late.
In my example, the total of 32 for A will print on the first line of
section B.

What am I doing wrong?
 
You should share your code.

I think you need to run the MoveLayout in the On Format of the final detail
record.
Add a text box to the detail section:
Name: txtCountGroupRS
Control Source: =1
Running Sum: Over Group
Visible: No

Add a text box to the Group Footer section:
Name: txtCountGroup
Control Source: =Count(*)
Running Sum: No
Visible: No

Add code to the On Format event of the detail section:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.MoveLayout = (Me.txtCountGroup <> Me.txtCountGroupRS)
End Sub
 
You should share your code.

I think you need to run the MoveLayout in the On Format of the final detail
record.
Add a text box to the detail section:
Name: txtCountGroupRS
Control Source: =1
Running Sum: Over Group
Visible: No

Add a text box to the Group Footer section:
Name: txtCountGroup
Control Source: =Count(*)
Running Sum: No
Visible: No

Add code to the On Format event of the detail section:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.MoveLayout = (Me.txtCountGroup <> Me.txtCountGroupRS)
End Sub

Thank you, your post did exactly what I was looking for. I'll post
code next time something I cry for help.

Tony
 
Back
Top