Ecount

K

kmj1906

I am trying to use the ecount function:
CountOfAcct Number: ECount("[Acct Number]","[2a-Bad Phone Query]","[PAS Name]
='ATLANTA PAS'",True)

It seems to give me the correct total, however, I am trying to also group it
by patient type. For example, The total distinct count is 1,000 but
everytime I run the query it gives me:

ATLANTA PAS Emergency Room 1000
ATLANTA PAS Surgery 1000
ATLANTA PAS Inpatient 1000
ATLANTA PAS Outpatient 1000

However, what I really need is below (which is the true distinct count of
each patient type):

ATLANTA PAS Emergency Room 500
ATLANTA PAS Surgery 250
ATLANTA PAS Inpatient 200
ATLANTA PAS Outpatient 50

I am not very familiar with how the syntax of Ecount should be written to
accomplish this: Below is the total sql statement:

SELECT [2a-Bad Phone Query].[PAS Name], [2a-Bad Phone Query].[PT Type Name],
ECount("[Acct Number]","[2a-Bad Phone Query]","[PAS Name]='ATLANTA PAS'",True)
AS [CountOfAcct Number], Sum([2a-Bad Phone Query].Balance) AS SumOfBalance
FROM [2a-Bad Phone Query]
GROUP BY [2a-Bad Phone Query].[PAS Name], [2a-Bad Phone Query].[PT Type Name]
HAVING ((([2a-Bad Phone Query].[PAS Name])="Atlanta Pas"));

If someone could please help, I would be very appreciative..I have been
looking at this for a while

THank you
 
G

Guest

Hi

I have copied the beginning of your query below and changed the ECount part...

SELECT [2a-Bad Phone Query].[PAS Name],
[2a-Bad Phone Query].[PT Type Name],
ECount("[Acct Number]","[2a-Bad Phone Query]","[PAS Name]='" & [PAS Name] &
"' and [PT Type Name]='" & [PT Type Name] & "'",True)
AS [CountOfAcct Number],

Watch out for the single quotes next to double quotes!
If it's hard to read the Ecount part could be re-written without single
quotes as...

ECount("[Acct Number]","[2a-Bad Phone Query]","[PAS Name]=" & chr(34) & [PAS
Name] & chr(34) & " and [PT Type Name]=" & chr(34) & [PT Type Name] &
chr(34),True)

Hope this helps

Regards

Andy Hull
 

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