473,480 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to place page numbering in a middle of page?

20 New Member
Hi All,

I know page numbers must be always in a report's page footer or page header section, but I need those numbers in a middle of page, and on every page. Is that possible? Thanks in advance
Mar 17 '11 #1
18 2157
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
I dont really think so, since the control has to be some area (Header/footer, or detail, yes I do believe the page control can be in the detail section as well, but I haven't tried).

Problem with putting it in the detail section is that it would be visible within every detail, and that also does not place the pagenumber in the middle of the screen.

Maybe if you told WHY you need it in the middle of the screen we could assist better.
Mar 17 '11 #2
bdmir
20 New Member
Currently we are putting in report footer small row which contains:number of pages, pages in envelope and some id's. Our clients want to have full A4 format white area for their data to put on, so some clients don't want to have any such rows(because it may increase number of pages). There is a padding left 2cm on each page, which is white area, there we should put that info in vertical position some how. Know what I mean?
Mar 18 '11 #3
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Do you have more then 1 detail per page?
Mar 18 '11 #4
bdmir
20 New Member
Yes, more than one. If only one it would be easy :)
Mar 18 '11 #5
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Does the detail contain any controls that can grow/shrink?
Mar 18 '11 #6
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
This is the simplest approach I can come up with.
1) Place a label on your detail event. In my example I just named it lbl_Example, though lbl_Page probably would have been a better name :P

2) Add this code to your reports module:
Expand|Select|Wrap|Line Numbers
  1. Private Const lngPageTop As Long = 7400  'Aprox placement of middle of page
  2. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  3.     Dim lngTop As Long
  4.     lngTop = Me.Top
  5.     'Assuming that a detail is no more then 2000 twips height
  6.     'Problem here is that me.height is the height BEFORE controls grow.
  7.     If Me.Top > lngPageTop - Me.Height And Me.Top < lngPageTop Then
  8.         Me.lbl_Example.Caption = Page
  9.         Me.lbl_Example.Visible = True
  10.  
  11.         'Reposition label to same position each time
  12.         Me.lbl_Example.Top = lngPageTop - Me.Top
  13.  
  14.     Else
  15.  
  16.         Me.lbl_Example.Visible = False
  17.     End If
  18.  
  19.  
  20. End Sub
Basicly the code tries to estimate whether or not the "middle" of page will be contained within the current detail, and if so, reposition and show the label.
The problem with this approach is that Me.Height is the details "design" height, it doesn't take growing controls into account. If you want to modify it to include growing controls, the best you can do is to use Stephen Levans code to guestimate the control height. I have used it quite successfully to force page brakes at specific locations in my reports, by guesstimating whether or not the next item would be able to fit on the page or not.
Mar 18 '11 #7
bdmir
20 New Member
Code is nice, but what if 1 group may have 4 pages, will that label be on each page or just on a first one? I guess I have too look at Stephen Lebans tricks
Mar 18 '11 #8
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Hmm...didn't think of that. If a detail goes across more then 1 page, I don't think my suggestion would work.
Mar 18 '11 #9
bdmir
20 New Member
Thanks for the quick replies. So I guess it is not possible. Right?
Mar 18 '11 #10
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
I dont usually go so far as to say that things are not possible. But I would say its close.

It would be quite cumbersome to deal with all the special cases, and to be honest it doesn't seem worth the hazzle.
Mar 18 '11 #11
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
OK, I have another approach (Which is why I usually don't say that things are impossible.)

Here is what I did:
In the Page event of the report, I used the following code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Page()
  2.     'Store old font values
  3.         Dim strCurrentFont As String
  4.         Dim intCurrentFontSize As Integer
  5.         Dim intCurrentScaleMode As Integer
  6.  
  7.         strCurrentFont = Me.FontName
  8.         intCurrentFontSize = Me.FontSize
  9.         intCurrentScaleMode = Me.ScaleMode
  10.  
  11.     'Set font values for our pagelabel
  12.         Me.FontName = "Times New Roman"
  13.         Me.ScaleMode = 3
  14.         Me.FontSize = 16
  15.  
  16.     'Print to page
  17.         Me.CurrentX = 50
  18.         Me.CurrentY = 3000
  19.         Me.Print Page()
  20.  
  21.     'Reset to old values
  22.         Me.FontName = strCurrentFont
  23.         Me.FontSize = intCurrentFontSize
  24.         Me.ScaleMode = intCurrentScaleMode
  25. End Sub
This will print the page number on the page, at the location specified by CurrentX and CurrentY.

I have never used the page event before, so I honestly don't know if there are any issues/problems with this method, but my admittedly short testing didn't reveal any issues.
Mar 21 '11 #12
bdmir
20 New Member
Great! That is what I need. Never thought about "Me.Print Page()" Thanks for the help.
Mar 21 '11 #13
bdmir
20 New Member
Is it possible to print that in vertical orientation?
Mar 21 '11 #14
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
You want the label turned 90 degrees? Or to be printed on a report that is turned?
Mar 21 '11 #15
bdmir
20 New Member
Just a label 90 degrees. That will be enough :)
Mar 22 '11 #16
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Nothing springs to mind. Access must have some method for printing the vertical labels you can make, but I don't know how to find/use it.
Mar 22 '11 #17
bdmir
20 New Member
I found something, but it works only for forms. How about the reports? Here is a link

http://www.xtremevbtalk.com/showthread.php?t=205165
Mar 24 '11 #18
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
I honestly don't know of hand (nor after an hour spent), how to modify it for reports.
Mar 24 '11 #19

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

Similar topics

1
2191
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...
2
3869
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...
3
5105
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...
3
1576
by: ravib | last post by:
how to transfer one page to an other page through middle page in javascript
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...
4
2471
by: bhughes2187 | last post by:
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...
2
4321
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...
2
1437
oranoos3000
by: oranoos3000 | last post by:
hi I have a login page in my site for login member I want to any user that arrival correctly directly go to page1.php I use header statement(header("Location: page1.php")) in middle page that...
7
2752
by: Reedsp | last post by:
I have a report that displays the page numbering incorrectly. Example page 1 of 3 but only 2 pages are displayed when previewing or printing the report. Here is the details: Page footer - text...
0
7044
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
7084
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
6739
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
6929
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
5337
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,...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
181
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.