Solved

Count on group footer

Posted on 2015-01-29
7
94 Views
Last Modified: 2015-01-29
Hi Experts,
I'm working on a report and having problem to count on the group footer.  In the report, I have Date, TagNo, Chair (store as "C" in the table), Desk (store as "D" in the table).  My report only show Date, TagNo, Chair, Desk but group by Date.  so the Date has header and footer. here is the report look like:

1/2/15 (date)
    C0001 (TagNo)          Chair (C)
    C0002                         Desk (D)
    C0003                         Chair (C)

I want to count how many chair and how many desk on this date, so on the Date footer will show : Total of Chair : 2  Total of Desk : 1

here is the code I put in the control source of the Text box on the Date footer:
Total of Chair: =Count([Type]="C")
Total of Desk: =Count([TYPE]="D")

but both show as 2 not one is 2 and one is 1, do not know why it happens.

Thanks,
0
Comment
Question by:urjudo
  • 4
  • 2
7 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40577704
Try something like this in the Date footer:

=Dcount("Type","YourTable","YourDate=" & "#" & YourDate & "#" & " AND Type='C'")
=Dcount("Type","YourTable","YourDate=" & "#" & YourDate & "#" & " AND Type='D'")

JeffCoachman
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 400 total points
ID: 40577711
Use:

=Sum(IIF([Type]="C",1,0))

and:

=Sum(IIF([Type]="D",1,0))

Jim.
0
 
LVL 57
ID: 40577717
Count(<expression>) just tally's up the count of records where a field (or fields) is not null.

Jim.
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40577719
What *exactly* is stored in the Type field?
"C" or "Chair"
"D" or "Desk"
or even:
"Chair (C)"
and
 "Chair (D)"
My post presumes "C" or "D"
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 100 total points
ID: 40577727
I think Jim's Post would works better for you.
My post presumes that you have no other filters in the Report's Recordsource (and was untested)
0
 

Author Closing Comment

by:urjudo
ID: 40577757
Thank you!!!
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40577774
If Jim's post worked for you, ...you did not have to accept my post as assisting.
Jeff
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now