Results 1 to 4 of 4
  1. #1
    schristy is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2010
    Posts
    2

    suppress subtotals when only 1 record

    I have a report that is way too long because it prints subtotals even when there is only one detail record. Is there a way to suppress the subtotal if there is only one detail AND to not leave a space for the subtotal if it is suppressed.

  2. #2
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Put a record counter control in the detail section of the report.

    On the OnFormat event of the footer or group where the subtotal is printed, test that record counter. If 1, set the subtotal control "Visible" property to No, otherwise, set it to Yes.

  3. #3
    schristy is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2010
    Posts
    2

    not sure of fomatting

    I loved your idea but I can't get it to work. Any thoughts on formatting? Here's what I typed in where "ct" is the counter and "amt" is the field I am subtotaling.

    =IIf([ct]>1,Sum([Amt].[Visible])=True,Sum([Amt].[Visible])=False)

  4. #4
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Think about what you did, you summed a visible property. You weren't even close.

    Use in the report footer Onformat event
    Code:
    if me.cnt 1 then
     me
    .amt.visible true
    else
     
    me.amt.visible false
    end 
    if 
    Substitute the real count detail section control name for "cnt" and the real footer total control name for "amt".

Please reply to this thread with any new information or opinions.

Similar Threads

  1. If duplicate record, go to original record
    By BigBear in forum Forms
    Replies: 2
    Last Post: 10-06-2010, 02:58 AM
  2. If duplicate record, go to original record
    By islandboy in forum Access
    Replies: 51
    Last Post: 06-02-2010, 04:17 PM
  3. Replies: 0
    Last Post: 11-03-2009, 11:42 AM
  4. Replies: 3
    Last Post: 06-27-2009, 03:53 PM
  5. Deleting Record Contents, not complete record...
    By Charles Waters in forum Access
    Replies: 2
    Last Post: 06-24-2008, 12:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums