Count report pages from public function, without hidden controls

XelaIrodavlas

Registered User.
Local time
Today, 21:37
Joined
Oct 26, 2012
Messages
175
Hi all,

I'm putting in place a register to log each time a report is printed.

I wanted to record how many pages long each one is, but
it needs to apply to any report on our system, so I want each one to call the same function.

So, is there a method I can use to count the pages programmatically, from a separate function in a public module? I've been toying with something like this:

MyVar = Reports(MyReport).report.pages

...but it keeps returning 0.

Any ideas? Thanks in advance :)
 
put a line number control on your page footer, then test it again.
Myvar = reports!MyReport.Pages
 
Hi Arnelgp, thanks for the reply. I'm not sure exactly what you mean by Line Number control could you please explain?

I'm trying to find a method which doesn't involve changing the controls on individual reports (if possible) but rather add a simple call function to the OnPage event that will log when the report is printed. Right now there are only about 20 reports but that could grow at any time.

Many thanks, :)
 
So further searching of the internet seems to be suggesting Access is not able to calculate the total number of pages on a report - unless you include a control on said report... surely that can't be right?

Does anyone have a working example of when report.pages is actually useful? it doesn't make any sense to me :confused:
 
access cannot determine the actual page of report, until you have scrolled to the last page of it. by putting a page number control on the page footer, the report actually do a second pass on the report, therefore the number of pages can be known.
 

Users who are viewing this thread

Back
Top Bottom