Count function question

P

pow67

Without making another query, I would like to count to number of records
in a particular [CITY] such as "Deerfield". Is this possible ?

None of these worked:

=Count([CITY] Like "Deerfield")

=Count([CITY]."Deerfield")

=Count([CITY.Deerfield])

=DCount("[CITY]", "Deerfield")

Thanks in advance.

CW

=Count([CITY] like "allendale")
 
P

pow67

Thanks for you help. As you suggested, I entered:

=DCount("*", "AldCat", "[CITY] Like """Deerfield""")

but when I save the report the control source is truncated to:

=DCount([CITY],"Deerfield")

and "#error" appears on the report.

I also count 11 quote marks in your suggestion but I am not sure which
one to delete (or add another) to make it an even number.

Thanks again in advance.

CW
 
B

Bruce M. Thompson

=DCount("*", "AldCat", "[CITY] Like """Deerfield""")
but when I save the report the control source is truncated to:

=DCount([CITY],"Deerfield")

and "#error" appears on the report.

I also count 11 quote marks in your suggestion but I am not sure which
one to delete (or add another) to make it an even number.

Good catch. Try:

=DCount("*", "AldCat", "[CITY] Like ""Deerfield""")

The embedded double double quotes represent single double quotes (") when the
expression is evaluated - string comparisons need to have the string values
surrounded by quotes.

As for why the control's "control source" property is changing when you save the
report, it may have been related to the syntax error that you discovered.

:)
 
P

pow67

That did it. It works.

Thanks again.

I am still not clear on what the "*" does after =DCount(....). Could you
elaborate or direct me to a resource?

CW
 

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