473,499 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page Numbering Function

32 New Member
I am trying to sequentially place page numbers across multiple reports.
Basically what I am trying to do is on the first report, which has 3 pages, the first page is page one...after cycling through the pages and then closing the report, the next report opens and the page number starts at 4.

I found an example of this, but when I try and incorporate it, it counts each line on the page as a page so instead of saying Page 1, it says Page 25 (the number of lines on the page is 24). I cannot figure it out.

Expand|Select|Wrap|Line Numbers
  1. (pagenumberfunctions)
  2.  
  3. Option Compare Database
  4.  
  5. Dim PageNumber As Integer
  6. Sub initPageNums()
  7.  PageNumber = 0
  8. End Sub
  9. Function GetPageNumbers() As Integer
  10.  PageNumber = PageNumber + 1
  11.  GetPageNumbers = PageNumber
  12. End Function
  13.  
That is my code in a module called pagenumberfunctions.

On the first report, on open, I call initPageNums as an event.
I then have an unbound text box in the page footer that has a control source of
=GetPageNumbers()

But like I said it displays 25 instead of 1, 25 being the number of lines on the page + 1. Why would it count each line as a seperate page?
Mar 20 '08 #1
4 2472
FishVal
2,653 Recognized Expert Specialist
Hi, there.

I guess it calls the function each time it formats a record.
Would it be more reliable if your VBA function will return the first page number only and then in report control it will be added to current page number?

Regards,
Fish
Mar 20 '08 #2
ADezii
8,834 Recognized Expert Expert
I am trying to sequentially place page numbers across multiple reports.
Basically what I am trying to do is on the first report, which has 3 pages, the first page is page one...after cycling through the pages and then closing the report, the next report opens and the page number starts at 4.

I found an example of this, but when I try and incorporate it, it counts each line on the page as a page so instead of saying Page 1, it says Page 25 (the number of lines on the page is 24). I cannot figure it out.

Expand|Select|Wrap|Line Numbers
  1. (pagenumberfunctions)
  2.  
  3. Option Compare Database
  4.  
  5. Dim PageNumber As Integer
  6. Sub initPageNums()
  7.  PageNumber = 0
  8. End Sub
  9. Function GetPageNumbers() As Integer
  10.  PageNumber = PageNumber + 1
  11.  GetPageNumbers = PageNumber
  12. End Function
  13.  
That is my code in a module called pagenumberfunctions.

On the first report, on open, I call initPageNums as an event.
I then have an unbound text box in the page footer that has a control source of
=GetPageNumbers()

But like I said it displays 25 instead of 1, 25 being the number of lines on the page + 1. Why would it count each line as a seperate page?
  1. In Standard Code Module:
    Expand|Select|Wrap|Line Numbers
    1. Public lngPageNumber As Long
  2. Create a Text Box in all Page Footers in all Reports named txtPageNum.
  3. Initialize Public Variable in the Open() Event of the "1st" Form only:
    Expand|Select|Wrap|Line Numbers
    1. lngPageNum = 0
  4. Place the following code in the Format() Event of all Report Page Footers:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
    2.   lngPageNumber = lngPageNumber + 1
    3.   Me![txtPageNum] = "Page Number: " & lngPageNumber
    4. End Sub
Mar 20 '08 #3
bhughes2187
32 New Member
  1. In Standard Code Module:
    Expand|Select|Wrap|Line Numbers
    1. Public lngPageNumber As Long
  2. Create a Text Box in all Page Footers in all Reports named txtPageNum.
  3. Initialize Public Variable in the Open() Event of the "1st" Form only:
    Expand|Select|Wrap|Line Numbers
    1. lngPageNum = 0
  4. Place the following code in the Format() Event of all Report Page Footers:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
    2.   lngPageNumber = lngPageNumber + 1
    3.   Me![txtPageNum] = "Page Number: " & lngPageNumber
    4. End Sub

Thanks! I'll give this a try. Was planning on scrapping the original thought and trying to figure out a better way of doing it.. Appreciate it much!


edit: You are FABULOUS!!! That works, thanks
Mar 20 '08 #4
ADezii
8,834 Recognized Expert Expert
Thanks! I'll give this a try. Was planning on scrapping the original thought and trying to figure out a better way of doing it.. Appreciate it much!


edit: You are FABULOUS!!! That works, thanks
You are quite welcome.
Mar 20 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2192
by: will | last post by:
Hope someone can help me here, as I can't find the answer anywhere. I'm printing documents using XML and XSL:FO. The documents are double-sided. I want to number the pages so that the physical...
5
4595
by: Charles McCaffery | last post by:
I have written a database with auto-numbering and now wish to remove alkl of my test data and set the auto-numbering back to one. How do I do this please? Charles McCaffery.
2
2288
by: Wayne Aprato | last post by:
I posted this yesterday and it seems like a moderator has thrown it in another thread. This is a totally different question to the one asked in that thread, so I'm posting it again. It is not a...
2
3870
by: Elasho | last post by:
I have a report that groups data on an Area, the report is set to force a new page for each Area within the report. Each Area will have 1 or more pages. Is it possible to make the page...
1
2646
by: Simon | last post by:
Dear reader, Most of the reports have a page numbering as Page x of nn, starting at the first page 1 (one) to the last page nn. But know I need to start with Page 1 of nn for each...
0
1272
by: palmorek | last post by:
I am trying to build a macro in Excel for the purpose of authorizing checks. I am trying to figure out when the user is done entering their information they hit an enter button and the macro will...
3
5106
by: joelpollock | last post by:
I'm having trouble continuously page numbering a large report in MS Access. The report is made up of three separate Access reports which I join together at the end. In the past I have opened the...
0
1326
by: jimratajski | last post by:
Can anyone tell me how to automate page numbering of spawned page templates in Acrobat? I have a number of forms containing hidden page templates that I would like to be auto numbered as they are...
2
4323
by: booher | last post by:
I need help generating a PDF output where the page numbering restarts at 1 with every new chapter in a document. So the output would look something like 1-1, 1-2, 1-3,..., 2-1, 2-2, 2-3,... I'm...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7388
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.