Ecount on filtered records

L

Lyletti

Greetings,

I am using Access 2003.
I have a form based on a query q_SessionGrid, that includes the following
fields:
Client
Therapist
Date
Attendance (the values here can be A,C or N)
FeeDue
FeePaid

I am using Allen Browne's Search2000 combo box
method to filter sessions by Client and/or Therapist and/or Date range.
Each record retrieved includes data for each of the fields (i.e.,no nulls)
So far so good.

In the footer, I have unbound controls displaying Sums for the
FeeDue and FeePaid for the sessions displayed after the filter is on,
and a Count of the total number of sessions displayed.

Those sessions include a mix of A, C and N values.
I would like a Count of ONLY the A values.

I tried (as a first effort with Ecount after realizing Dcount didn't work)
=Ecount("*","q_SessionGrid","Attendance = 'A'")
and it retrieves all the A values in the underlying query.

I only want to see the count for the records displayed when the filter
is on, and I can't figure out how to reference only those records.

Thank you in advance for your suggestions
 
A

Allen Browne

Depending what's in the form's filter, it may be possible to add the filter
as part of the criteria:
=DCount("*", "q_SessionGrid", "Attendance = 'A'" &
IIf([Form].[FilterOn], " AND (" & [Form].[Filter] & ")", Null))

Should be the same for DCount() or ECount(), since you are not asking for
unique values.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top