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

Report Totals Double when Printed

Status
Not open for further replies.

a75537

Programmer
Feb 26, 2003
25
CA
I have a report that lists questions, and whether or not the questions are answered yes or no. The totals are displayed at the end of the report.

For example:
Question 1 Yes
Question 2 Yes
Question 3 No
Total Questions: 3 Yes: 2 No: 1 Accuracy: 66.67%

The report is displayed perfect on the screen, however, when the user prints the report all of the totals are doubled. In the example above, the totals are printed as:

Total Questions: 6 Yes: 4 No: 2 Accuracy: 66.67%

In addition, the totals keep doubling every time the report is printed - but it is always displayed correctly on the screen.

This has me baffled. Has anyone every seen this before, or have any suggestions for me?

Thanks.
 
Are you doing calculations within the OnFormat event? If so, you will need to take account of the OnRetreat event too, as a report page may be calculated several times before it is actually previewed/printed.
 
I do have some code in the OnFormat event of the Report Header, but it has nothing to do with the calculations. I'm just setting the caption of a label in the report header.

Do you think this could be the problem?

Thanks.
 
Create a text box called 'txtYesQs' within the detail section and bind it to your yes/no field. On the data property page make it a running sum overall. Then on your report footer create another textbox called 'txtYesTotal' and bind it to '=Abs([txtYesQs])'. This will give a count of your yes responses. As we are using Access, a yes value is stored as -1. We add up these -1's in our running sum field. The Abs() function returns the absolute value - making a number positive if it is negative.

Now create another textbox on the detail section called 'txtCountQs' and bind it to '=1', again making it a running sum. Then create another textbox in the report footer called 'txtTotalQs' and bind it to '=[txtCountQs]'. This gives you the total number of questions displayed in the footer.

Another textbox on the footer bound to '=[txtTotalQs]-[txtYesTotal]' will then give you the total No's. When you have verified it is working, make the textboxes on the detail section invisible - I usually also set the background to that disgusting magenta colour that nobody in their right mind would use, to remind me they are not visible.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top