Skip to content

Latest commit

 

History

History
56 lines (34 loc) · 1.75 KB

Access.Report.Pages.md

File metadata and controls

56 lines (34 loc) · 1.75 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Report.Pages property (Access)
vbaac10.chm13722
vbaac10.chm13722
Access.Report.Pages
b97a6878-0a2c-3834-8f3d-6f4460dab3bd
03/06/2019
medium

Report.Pages property (Access)

Use the Pages property to return information needed to print page numbers in a report. Read/write Integer.

Syntax

expression.Pages

expression A variable that represents a Report object.

Remarks

This property is only available in Print Preview or when printing.

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 expressions as the ControlSource property setting for a text box in a page footer.

This expression Prints
=Page A page number (for example, 1, 2, 3) in the page footer.
="Page" & Page & "of" & Pages "Page n of nn" (for example, Page 1 of 5, Page 2 of 5) in the page footer.
=Pages The total number of pages in the form (for example, 5).

Example

The following example displays a message that tells how many pages the report contains. For this example to work, the report must include a text box for which the ControlSource property is set to the expression =Pages. To test this example, paste the following code into the Page event for the Alphabetical List of Products form.

Dim intTotalPages As Integer 
Dim strMsg As String 
 
intTotalPages = Me.Pages 
strMsg = "This report contains " & intTotalPages & " pages." 
MsgBox strMsg

[!includeSupport and feedback]