Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to prevent subtotal printing if only 1 detail record

Status
Not open for further replies.

SuzM

Technical User
Oct 14, 2003
1
0
0
US
If there an easy way to prevent subtotals from printing if there is only a single detail record in the group? I assume I have to add code to OnFormat??
 
If you're subtotalling in a footer, you might be able to do a detail count. Then you can set all your subtotal fields to

=Iif ([txtDetailCount] > 1, [txtSubTotal], "")

Hope that helps!
 
I assume you don't want to print the entire group footer section. If this is the case, you can add a text box that counts the number of records in the group (txtDetailCount) and then add code to the On Format event of the group footer.

Code:
Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
    Cancel = Me.txtDetailCount = 1
End Sub

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top