Results 1 to 2 of 2
  1. #1
    sandyg is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2009
    Posts
    6

    supress subtotals code

    I need to suppress subtotals when there is only one value for a field and display the subtotal when there is more than one value. I have put a record counter control in the detail section of the report and I am tryping to create an OnFormat Event in the footer where the subtotal is printed. I don't know how to write code to set the subtoal control to visible if the count is >1 and not visible if not. The record counter in the detail section is called count and the subtotal in the footer section is called subtotal.

    Or can this be done with conditional formatting?

    Thanks,



    Sandy

  2. #2
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    705
    Sandy,

    The way I do it is this:

    put a text box on the footer section with these properties:
    control Name: txtCount
    Control source: =Count(*)
    Visible = No -

    In the Section Footer's On Format event use:

    Code:
    Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
    
         Me.subtotal.Visible = (Me.txtcount > 1)
    
    End Sub
    or you could hide the footer section completely with this:


    Code:
    Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
    
         Me.GroupFooter1.Visible = (Me.txtcount > 1)
    
    End Sub

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

Similar Threads

  1. Replies: 0
    Last Post: 11-17-2010, 01:21 AM
  2. Subtotals within a query
    By mulefeathers in forum Queries
    Replies: 2
    Last Post: 06-07-2010, 01:02 PM
  3. Replies: 1
    Last Post: 06-02-2010, 10:05 AM
  4. suppress subtotals when only 1 record
    By schristy in forum Reports
    Replies: 3
    Last Post: 02-15-2010, 10:00 AM
  5. Replies: 0
    Last Post: 08-07-2008, 07:02 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