Total pages in Access report showing as negative number (1 Viewer)

isladogs

MVP / VIP
Local time
Today, 12:07
Joined
Jan 14, 2017
Messages
18,186
Here's a strange issue I've not seen before
I have a report with a very large number of records
Filtered = 1758312 records ; Unfiltered = 2604721

I don't want anyone to print the report 'by accident' so I want the total number of pages to be displayed

In both cases the standard 'page of pages' footer shows as a negative number.



Also peculiar is that the filtered report with fewer records is more negative

My initial guess was that the built in Pages function is an integer & that the total pages had exceeded the integer value limit (32767) & somehow restarted from the negative integer limit

Having checked there are 47 records per page, so I've done a calculation of what I'd expect the result to be in each case.



So it does exceed the integer limit in each case but I still can't make sense of the valuers shown.
Can anyone else explain what is happening.
Even better can anyone give me a solution (apart from hide the '& Pages')
 

Attachments

  • Calcs.PNG
    Calcs.PNG
    5 KB · Views: 295
  • NegativePagesSummary.PNG
    NegativePagesSummary.PNG
    14.9 KB · Views: 333
Last edited:

jdraw

Super Moderator
Staff member
Local time
Today, 08:07
Joined
Jan 23, 2006
Messages
15,361
Colin,

I saw this at stackoverflow


Code:
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. :)
 

isladogs

MVP / VIP
Local time
Today, 12:07
Joined
Jan 14, 2017
Messages
18,186
Jack

Once again you are an absolute star.
I had spent ages searching for this topic without a single hit!

The link to SO didn't work for me however

Your solution not only works - as you say it gives EXACTLY the number of pages that my earlier calculation predicted.
The solution also confirms my original supposition about integer limits

I just hope nobody ever tries to print a report with 55420 pages



EDIT - just tried to award you well deserved RPs but it still won't allow me to do so - there must be a point after which old RPs are deemed to have lapsed
 

Attachments

  • FixedPages.PNG
    FixedPages.PNG
    5.9 KB · Views: 273

Users who are viewing this thread

Top Bottom