View Single Post
  #7  
Old May 14th, 2010, 07:39 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Record count in report w/o records

This won't work if you open the report with a where condition that filters
the records displayed in a report. I almost always use code like:

Dim strWhere as String
strWhere = "[DateField] Between #" & me.txtStart & "# AND #" & Me.txtEnd & "#"
DoCmd.OpenReport "rptMyReport", acPreview, , strWhere

Using DCount() will not understand the where condition so it is very
possible the displayed value will be greater than the actual number of
records returned in the report.

--
Duane Hookom
Microsoft Access MVP


"Steve" wrote:

Hello Ray,

DCount("*","NameOfYourQuery") will give you the number of records in
NameOfYourQuery. Add an unbound textbox to your report and put =
DCount("*","NameOfYourQuery") in the control source.

Steve




"swansonray" wrote in message
...
Hi all,

In the detail section of a report I want to display the number of records
a
query returns.

Example query named "support"
In the report I want to display Support = "number of records in query"
and then continue with the number of records in other querys with
different
names.

Thank you for your assistance.

Ray Swanson
Lemoore, CA



.