[AccessD] Count pages in a report

Darren DICK d.dick at uws.edu.au
Mon Nov 29 22:40:42 CST 2004


Hi Joe

To refer to the Pages property in a macro or Visual Basic, the form or
report must include a 
text box whose ControlSource property is set to an expression that uses
Pages. 
For example, you can use the following expression as the ControlSource
property setting 
for a text box in a page footer.
Eg me.
Try something like the following in the control source of a Text Box Control
on the report

Me.txtPageCounter = "Page " & Page & " of " & Pages
Or try
Me.txtNoOfPagesInThisReport = "There are " & Pages & " in this report"
Or try
Me.txtNoOfPagesInThisReport = Pages 

(Without testing) in VBA maybe something like 
if me.txtNoOfPagesInThisReport =1 then
	Msgbox "only 1 page"
elseif me.txtNoOfPagesInThisReport >1 then
	Msgbox "more than one page - infact we have " &
me.txtNoOfPagesInThisReport & " pages"
End if
(I havent tested that little bit though)

To get the page you are on...
Debug.Print Reports("rptMyReport").OnPage


This next bit tells you if you are on an even or Odd page number
Private Sub PageFooter_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo ErrorHandler

   dim intPageNo as integer
   intPageNo = Me.Page

   Debug.Print "Page: " & intPageNo

   If intPageNo Mod 2 = 0 Then
      'The page number is even
   Else
     ' the page number is false
   End If 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Hecht
Sent: Tuesday, 30 November 2004 2:51 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Count pages in a report

Anyone know how to do it?

 

Working on Purchase orders. If page count > 1 then I want to put page count
on all pages. If page count = 1 then no page count needs to be displayed.

 

 

 

JOE HECHT

LOS ANGELES CA 

jmhla at earthlink.net

 

--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list