Page numbering in reports

  • Thread starter Thread starter Andrew Proctor
  • Start date Start date
A

Andrew Proctor

This question seems so simple, yet I am tearing my hair out trying to
solve it. Hopefully someone out there can help...

I am creating a report in Access 2002. The report is an order
confirmation following a sale. It consists of a main report, with the
customer details etc. and a subreport with the itemised order details.

The users may wish to print out multiple confirmations at once, i.e.
at the end of a day, print confirmations for all the sales made today,
so I allow them to select sales from a list. I then create 2 linked
temporary tables, one of sales, and one of details. The main report is
based on the temporary sales table, and the subreport is based on the
temporary details table, and there are master/child links to keep it
all together.

Hopefully thats clear so far.

The problem I am having is I am simply trying to put a "Page N of M"
on each complete order confirmation, where M is the number of pages
for one confirmation only, so if I have 3 order confirmations of 2
pages each, I get page 1 of 2, and page 2 of 2 for each order, rather
than 1 of 6 etc.

This seems straightforward but I'm having a nightmare. I have trawled
this newsgroup, and the web. The closest I have come to a solution is
here:

http://www.mvps.org/access/reports/rpt0013.htm

but when I try the code, I get a "Subscript out of range" error as my
array seems to reset itself at some point, I'm not sure where yet.
Besides, I'm not really grouping my report in anycase, I just want the
numbering to reset when the report accesses a new record. Trying to
manipulate me.page in the formatpagefooter section has not proven
useful either.

Any help would be gratefully received and much appreciated.

Andrew
 
This question seems so simple, yet I am tearing my hair out trying to
solve it. Hopefully someone out there can help...
Success! And as per usual, it was a case of RTFM :) The link I
mentioned in my post above works fine, it is I who do not. There were
2 things I was doing wrong, in case anyone else has the same problem:

First, I was declaring my arrays as local variables within the
FormatPageFooter sub, so of course, they were getting re-initialised
and losing their values, hence my subscript out of range errors.
Secondly, I did not have a [=Pages] hidden field anywhere on my
report, so the report was only being formatted once. The code above
relies on the report being formatted twice, which it is if you ask
Access to count the total pages.

Hope this helps someone else.

Regards
Andrew
 
Andrew said:
(e-mail address removed) (Andrew Proctor) wrote
This question seems so simple, yet I am tearing my hair out trying to
solve it. Hopefully someone out there can help...
Success! And as per usual, it was a case of RTFM :) The link I
mentioned in my post above works fine, it is I who do not. There were
2 things I was doing wrong, in case anyone else has the same problem:

First, I was declaring my arrays as local variables within the
FormatPageFooter sub, so of course, they were getting re-initialised
and losing their values, hence my subscript out of range errors.
Secondly, I did not have a [=Pages] hidden field anywhere on my
report, so the report was only being formatted once. The code above
relies on the report being formatted twice, which it is if you ask
Access to count the total pages.


I'm glad you figured it out. I saw your question and was
struggling with a nice way to say that you were not
following the article's instructions correctly. Seemed a
little crude to reply with just RTFM ;-)
 
Back
Top