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

Counting records in a report

Status
Not open for further replies.

blumash

Programmer
Oct 2, 2003
50
HU
I m printing a report with "report all form myform......" , I would like at the end of the report to print how many names for example in the report , I can't count them while printing since it's done by report all , maybe someone have an idea how it can be done.

Thank's
 
You need to define a report variable in the report to count on a common field that is in each of the records so in the worse case that all the fields are different you can increment the record count on for example a date field. It doesnt matter what the date is it only maters that the field is printing so you could increment the variable by choosing 0 as its initial value selecting SUM and in the variable dialogue put IIF(!EMPTY(mydatefield),1,0) it can be any field that is printing.

Bob Palmer
The most common solution is H2O!
 
Hello Blumash:

There are many ways to count the records that you are printing.

1. You can print a column Count and put 1 as a value instead of a field and sum it in the footer.

2. You can also create a temp file and create field called COUNT or whatever, replace all with 1 and then print this field along with the rest of the report and sum at the end.

3. This one I am not sure, you can count the number of records but do not eject the page.
then
set print on
? 'Total Names',iTotal
eject
set print off
set device to screen


Hope it may help.

Try it

Nasib Kalsi
 
One of the easiest ways to count the records is to do something like the following:

Code:
  * --- Count Records In Report's Table/Cursor ---
  SELECT RptTable
  mnRecCount = RECCOUNT()

  * --- Run The Report ---
  SELECT RptTable
  REPORT FORM MyReport NOCONSOLE TO PRINT

Since you have defined the variable mnRecCount prior to running the report, by SCOPE it is now "visible" within the report. So you can place a TextBox somewhere on the report to display the value.

Good Luck,


JRB-Bldr
VisionQuest Consulting
Business Analyst & CIO Consulting Services
CIOServices@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top