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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chart repeating on report

Status
Not open for further replies.

Hawkide

Technical User
Oct 8, 2003
159
US
Access 97

I have a report with a chart in the detail section.

The Record Source property of the report is empty

Everything works fine. However, I want to display the count of the records on the report. I tried:

Count(*)

in a textbox, and it didn't work. When I set the Record Source property of the report to that of query from which the chart is built the textbox does display the RecordCount, but the chart is repeated RecordCount number of times.

Can someone explain this phenomena and offer a suggestion so that I can get the record count and still only display the chart once. TIA...
 
You say you want to display the record count of the records on the report, but if there is no recordsource, then there are no records and hence no record count.

Sounds like you want instead to count the records in the query that the chart is built on? The chart's a completely different object. I'd use dcount in a text box on the report.

So if it's not saved already, save the query that the chart is built on. Then use something like this (you'll have to tweak it with your own object names):

=dcount("ID","QueryName")

Try that and see if it works.

Another thing you could do is make the recordsource of your report be a TOTALS query, based on the query that's the source for the chart, and put in COUNT in the GROUP BY row, then there will only be one row returned, and the data will be the count of the records in the query.
g

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I should add that the chart is in the details section.

I know that I can set the Record Source property for the report and just put the chart in the Report Header (instead of the Details section). This will allow me to use Count(*) and only show one copy of the graph, but I was just wondering if there was a way to keep the chart in the details section and accomplsh the same thing? I thought there might be some property I could set or something... Any ideas???
 
Dcount works nicely...Thanks for the advice.

I had thought about using a second TOTALS query like your second suggestion, but DCount() is even simpler.
 
I already knew your chart was in the detail section because you wrote it in your original post.

Glad it worked out for you!

g

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top