Creating a Report

  • Thread starter Dominique Schwartz
  • Start date
D

Dominique Schwartz

I am attempting to create a report using a query, now this
report has to contain specific information, ie counts of
clients for various criteria. I've tried creating a custom
report and then defining the source as the query and using
=DCount("field","table","criteria") but when I run it I
get #Error appearing in the text box for the field I'm
trying to run the count for.
For example, I try to use =DCount
("Address","qryDomesticViolence","Address=urban") to get
the number of clients that are from an urban address, and
all I get is the #Error comming up in the report. I am
nearing the end of my rope and Need Help bad!
Thanks for your assistance!
 
D

Duane Hookom

If your DCount() is necessary, the correct syntax would be:
=DCount("Address","qryDomesticViolence","Address='urban'")
If the record source of the report is qryDomesticViolence, then the much
better method is to use:
=Abs(Sum([Address]="urban"))

_____________
Duane Hookom
MS Access MVP
 
F

Fredg

Dominique,
A couple of things.
1) Make sure the name of this control in NOT the same as
the name of any field in the control source expression.

2) Your DCount and criteria:
I'm guessing that Address and Urban are the names of 2 different fields in
the report,
or is "Urban" the data value in the Address Field?

If [Urban] is Text datatype Field:
=DCount("*","qryDomesticViolence","[Address] = '" & [Urban] & "'")

If [Urban] is a Number datatype Field(or a Yes/No field):
=DCount("*","qryDomesticViolence","[Address] = " & [Urban] )

If "Urban" is a text value
(such as [Address] = "Urban", or "Suburban" or "Rural", etc.)
then use:
=DCount("*","qryDomesticViolence","[Address] = 'Urban'")
 

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