View Single Post
  #10  
Old May 15th, 2010, 06:57 PM posted to microsoft.public.access.reports
Steve[_77_]
external usenet poster
 
Posts: 1,017
Default Record count in report w/o records

And my mistake .........
I said DLookup in my response back to you where I meant DCount like I
suggested to the OP.

DCount is the proper solution here!

Steve


"Duane Hookom" wrote in message
...
I guess I provided the best answer to the wrong question. I had responded a
few days ago with a reply that assumed the OP was referencing the reports
record source there was no reply stating I was off base.

I was probably more concerned about the number of times I have seen OPs
looking for report record counts and being told that DCount() is the
proper solution when it clearly isn't.


--
Duane Hookom
MS Access MVP


"Steve" wrote in message
...
Look again at the OP's post. The report is not open with a where clause.
DLookup is based on a self-contained query with it's own criteria.
DLookup will certainly work!

Steve


"Duane Hookom" wrote in message
...
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


.