Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Counting Check Boxes

    In a report, is there a way to count the number of checkboxes that are actually checked (rather than just counting the number of records)?

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Counting Check Boxes

    If you want this count to appear in a report footer, what you can do is create a text box containing the following calculated field in the detail band so that it calculates for each record:

    =iif([YesNoFieldName]=yes,1,0)

    set the property of the text box to running sum - over all and give it a name, for example YesNoCnt. You can also set visible to No so it does not appear on your report.

    Create a text box in your report footer and place the following calculation referencing the name you gave the text box you placed in the detail section. Example =[YesNoCnt]
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Counting Check Boxes

    Just as an afterthought to that, you could also use the formula =-[yesnofieldname] as yes is equivalent to -1.
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Counting Check Boxes

    You could also use Abs(Sum([YesNoField])) as long as the field doesn't allow a three-state value.
    Charlotte

  5. #5
    Star Lounger
    Join Date
    Jan 2001
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Counting Check Boxes

    Charlotte,

    Your suggestion about using the Abs(Sum[YesNoField])) to count the checkboxes worked, as long as I did that in the report footer. Is there any reason why this would not work if I tried to put it in the Page Footer? When I tried to enter it there, it only displayted #Error.

    -Kelley

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Counting Check Boxes

    The problem with calculations in page footers, is that Access doesn't really know when a page breaks because it's formatted on the fly. There is a sample report in the RptSmp00.mdb file (or RptSmp97.mdb, if you use 97) that demonstrates how to do this. You can find the 2000 version at http://support.microsoft.com/support/kb/ar...s/Q231/8/51.ASP
    Charlotte

Posting Permissions

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