Results 1 to 5 of 5

Thread: Report counting

  1. #1
    Join Date
    May 2006
    Posts
    8

    Unanswered: Report counting

    I have a field named --> [OneA], the user will either leave the box blank or they can enter 1 or 2. I would like to count the one's and two's in a report. I created an unbound text box in my report. I entered the following expression. I am not getting correct numbers. Any ideas?

    =IIf([onea]=1,Count([onea]),0)

    Thank you!


  2. #2
    Join Date
    Jul 2004
    Location
    Southampton, UK
    Posts
    368
    Probably the most straightforward way is to use report grouping. Add a grouping level for [onea] and add a footer for this group. Then add [onea] as an identifier and an unbound field count([onea]). You can also add some text fields for explanation like “total for…”

    The result if you include the detail will be:

    John 1
    Jim 1
    Sam 1

    Total for 1 is 3

    Jane 2
    Alan 2
    Mark 2
    Ian 2

    Total for 2 is 4


    If you don’t want to add the counts in at group levels (say if you want a summarised report footer), then check out the DCount() function again.

    Chris

  3. #3
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I think this would work for you:

    =Sum(IIf(Nz([OneA],0)=1,1,0))

  4. #4
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,475
    Provided Answers: 11
    Why not just create a query group by the [onea] and then count the [onea]

    the sql woul look something like

    SELECT Table1.Onea, Count(Table1.Onea) AS CountOfOnea
    FROM Table1
    GROUP BY Table1.Onea;

    then create the report.
    hope this help

    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.
    DONT WORRY ABOUT THOSE WHO TALK BEHIND YOUR BACK
    THEY'RE BEHIND YOU FOR A REASON

  5. #5
    Join Date
    May 2006
    Posts
    8

    It worked!

    I used the =Sum(IIf(Nz([OneA],0)=1,1,0))

    from DCKunkle. Thank you so much! Thank you awesome support team!

    Ofelia

Posting Permissions

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