How can the Count() function be used with a calculated field

B

bill7894

I'm having a problem with the Count() function.
I need to use it with a calculated field.
the field is calculated by using the following expression
AgeCategory:=Switch([Age At Service]<18,"CHILD",[Age At
Service]>17 And [Age At Service]<62,"ADULT",[Age At
Service]>61 And [Age At Service]<101,"SENIOR",[Age At
Service]>100,"UNKNOWN")

this function gives a different categories to each age
range <18 : Child, >18 and <61: Adult, etc.

I want to count how many children and how many adults I
have in the table.

can someone one help please.

Thank you.
 
T

Ted

If your calculation is being done in a query, you could
just have a second query based on the first that groups
by the category and just use the count function on any of
the fields that don't include blanks.

Or, if you want to do it from within a form, or you want
to do it in the original query, you could use the dcount
function. You could either have separate dcount funtions
for each age group, or you could try using the output
from your category expression to determine the criteria
for your dcount function.

Hope this helps.
 

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