views:

95

answers:

2

I have an access report that generates 36505 pages (un filtered, and about half of each page is taken up by group headers and page headers) , though the footer at the bottom of the report page says "36505 of -29031". This looks like an overflow problem maybe, though I'm confused how it got the current page number of the last page OK, but failed to get total page count. Has anyone dealt with this before?

+1  A: 

In my Access 2003 report, this reports Page as Long and Pages as Integer. (I assume your report has this as the footer text box expression: ="Page " & [Page] & " of " & [Pages]) So it makes sense you're getting an apparent overflow for Pages but not Page.

Private Sub Report_Open(Cancel As Integer)
    Debug.Print "TypeName(Me.Page) " & TypeName(Me.Page)
    Debug.Print "TypeName(Me.Pages) " & TypeName(Me.Pages)
End Sub

I don't know of a work-around. I've never dealt with such a huge report.

HansUp
That explains the problem. I guess it begs the next question: Why are they of different types when they represent the same kind of information?
FrustratedWithFormsDesigner
No idea here, Frustrated. I was surprised to see that. Superficially at least it seems stupid to me.
HansUp
Nice work. And very interesting. Almost certainly a holdover from Access 1.0 days on Win 3.1 and never been updated. I can also see the discussions now "But nobody will ever print a report with more than 10,000 pages."
Tony Toews
I think it's quite reasonable. If you have so many pages that it overflows the integer data type, your report is going to take a RILLY long time to calculate the value of Pages.
David-W-Fenton
+4  A: 

I found a clue on this page:

http://www.sqldrill.com/excel/access-reports/695207-access-prints-negative-number.html

But the expression wasn't 100% so I had to modify it:

="Page " & [Page] & " of " & IIf([Pages]<1,(32768-Abs([Pages]))+32768,[Pages])

Page numbers appear to be correct now. :)

FrustratedWithFormsDesigner
+1 Good sleuthing on that one. Still I think my preferred solution would be a shorter report. :-)
HansUp
Nahsup. Hehehe Agreed.
Tony Toews