How do you count records based on the opened query?

Minddumps

Registered User.
Local time
Today, 18:01
Joined
Jul 5, 2011
Messages
73
[SOLVED--SEE BELOW TRAFFIC]

I've created a report to list every record (1900 something total). This one main report is used to open my many querys (more than 50). In order to save myself from creating numerous reports I filter the records through my command button before opening the report. Once in the report, I'd like to count certain cells of the records.

So for example I have
BN, CO, ST fields in my table that are a yes or no input. I need the code to tell the record to count how many records are 1. yes BNs, 2. yes COs, and 3. yes ST opened through the query that is currently filtered in the report

Currently I have inputted this code into an unbound box for each of the 3 fields needed:
Code:
=Nz(DCount("*","How_many_COs?"),0)
The problem with this is that it tells me the results of How many COs (BN's and ST for the others) there are for the entire table and not the current filtered query.

Does anyone know how to tell the code to only count the records currently filtered?
 
Last edited:
You really should do this in the RecordSource for the report (a query). Then you can count on each instance and sum it on the report. This will also help the report load faster as with that many calculations on the report it will take a bit to load. Look at GROUPS and TOTALS in Help (or Google it).
 
You really should do this in the RecordSource for the report (a query). Then you can count on each instance and sum it on the report. This will also help the report load faster as with that many calculations on the report it will take a bit to load. Look at GROUPS and TOTALS in Help (or Google it).
I completely forgot I can select no in the visible property. Using the groups total worked perfectly! I can't believe what an easy solution took me forever to get ! lol... Thanks for your suggestion it was MUCH appreciated :D

OH and almost forgot to mention (in case others are searching this later). I kept getting errors on my data totals bc I tried placing my boxes within the page footer instead of the actual report footer.
 
You're welcome and thanks for sharing it is bound to help someone else!
 

Users who are viewing this thread

Back
Top Bottom