Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

counting select records in same db field

Status
Not open for further replies.

melrse

Programmer
Dec 13, 2000
25
US
Hi. Please, can someone direct me on the following-I have tried dcount and subqueries and not right.
Using a db field which contains diverse entries ie: 01,02 thru 10. I need to have a count for the number of each that exist at the bottom of the report.
Whenever I use a select such as fieldname where = "02" I get a pop up prompt. How is this done.
I have a preselection prereport query where I am selecting records from a date range with these 01.02 thru 10 values.
I need to print detail out 01, 02, 10 and than give a grand total for each number.
01... xxxx
02... xxxx
can't get it.
Thanks much,
Melissa
 
Have you tried a crosstab query? This is usually what I use for such reports.

or even using the sums row in query?

i.e. groupby(fieldname), count(fieldname)?
 
You can use expressions like:
=Abs(Sum(FieldName="01"))
=Abs(Sum(FieldName="02"))
...
=Abs(Sum(FieldName="10"))

I would rather create a totals query and bind it to a subreport. That way if you add a new unique value in FieldName for instance "11", your subreport will automatically include this.
Also, remember the above expressions do not work in PAGE Headers and PAGE Footers.

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top