Report Printing Problem

Dominato

Registered User.
Local time
Today, 08:14
Joined
Apr 10, 2002
Messages
19
When I view my report in Access, everything is fine. However, when I print the report, it prints different numbers then were displayed on the report on the screen. What's going on here? A few notes, I have a report and subreport. The subreport prints fine, but the reports numbers change. Only the calculated fields are screwy.
 
I think that you'll find the printed results to be correct. If in print view, you skip over pages, Access doesn't include the skipped data in the calculations. For example, if you have a 20 page report, and after opening it, go immediately to the last page, the totals are likely to be incorrect. However, if you scroll page by page, they should be correct.
 
Well its only a 2 page report and the values on the first and second page are correct on the screen. But when I print, the calculated values on the first page are doubled. The ones on the second page are fine. Oh well, nevertheless, thanks for the reply.
 
The footer of one of my groupings. (Not the page or report footer)
 
This is a partial excerpt from help on the Format event:

"There are times when Microsoft Access must return to previous sections on a report to perform multiple formatting passes. When this happens, the Retreat event occurs as the report returns to each previous section, and the Format event occurs more than once for each section. You can run a macro or event procedure when the Retreat event occurs to undo any changes that you made when the Format event occurred for the section. This is useful when your Format macro or event procedure carries out actions, such as calculating page totals or controlling the size of a section, that you want to perform only once for each section."

And more help:

"Microsoft Access increments the FormatCount property each time the OnFormat property setting is evaluated for the current section. As the next section is formatted, Microsoft Access resets the FormatCount property to 1.
Under some circumstances, Microsoft Access formats a section more than once. For example, you might design a report in which the KeepTogether property for the detail section is set to Yes. When Microsoft Access reaches the bottom of a page, it formats the current detail section once to see if it will fit. If it doesn't fit, Microsoft Access moves to the next page and formats the detail section again. In this case, the setting for the FormatCount property for the detail section is 2 because it was formatted twice before it was printed."
 
From MS KnowledgeBase try this:

Enter the following code in the event procedure for the Format property of the page header:

Private Sub PageHeader_Format(Cancel As Integer, FormatCount As Integer)

' reset the counter for each new page

PageSum = 0

End Sub

Replace PageSum with the appropriate page variable.

HTH,

Lyn
 
Thanks everyone. I got it fixed. It was very similiar to what you were all saying. I had to set all variables to zero then it worked fine. Thanks again.
 

Users who are viewing this thread

Back
Top Bottom