Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Sep 2008
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Count function in a report (2002)

    Is it possible to use the =Count() or DCount() function in textbox on a report to count the number of records in a field called ContractDecision that = "Enroll" or do I have to do the counting in a query?

    What would the code be if I can do it in the textbox?

    Thanks.

    Paul

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Count function in a report (2002)

    You can use a text box in the report footer or group footer with control source

    =Abs(Sum([ContractDecision]="Enroll"))

    [ContractDecision]="Enroll" evaluates to True = -1 if the value is "Enroll", and to False = 0 otherwise. Since each record with "Enroll" contributes -1, the Sum is the number of such records but with a minus sign. Abs (absolute value) turns this into a positive number.

  3. #3
    Lounger
    Join Date
    Sep 2008
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Count function in a report (2002)

    That worked.

    Thanks again Hans.

  4. #4
    Lounger
    Join Date
    Sep 2008
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Count function in a report (2002)

    Let's go one step more.

    How do I modify =Abs(Sum([ContractDecision]="Enroll")) to count the number of Yes (-1) in a yes/no checkbox called [HoldPlaced].

    All the varations I tried did not work.

    Paul

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Count function in a report (2002)

    That's actually simpler because a Yes/No field already contains True=-1 or False=0, so you can use

    =Abs(Sum([HoldPlaced]))

  6. #6
    Lounger
    Join Date
    Sep 2008
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Count function in a report (2002)

    Thanks again.

    Sorry for double post. Did not know if you would see the one at the end of other post.

    Paul

Posting Permissions

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