Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / October 2007

Tip: Looking for answers? Try searching our database.

Count number of pages of a report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lamar - 17 Oct 2007 16:42 GMT
I have report that I need to have the number of pages counted and then the
number placed in a text box on a form.  I am able to do this using the below
code in the report.  The problem is first the report has be previewed or
printed before it performs this operation.  

Can I get the number of pages of the report without having to print or
preview it and the user seeing this happen?  i.e. It does not matter if the
report is opened or previewed as long as the user does not see this.  Thanks
for any help.  My code is below:

Private Sub Report_Page()

Dim intPage As Integer

   intPage = Me.Pages
   Forms![FaxEmployment2]![txtComputerPrintouts] = intPage - 1

End Sub
fredg - 17 Oct 2007 17:14 GMT
> I have report that I need to have the number of pages counted and then the
> number placed in a text box on a form.  I am able to do this using the below
[quoted text clipped - 14 lines]
>  
> End Sub

Make sure there is a control in the report that calculates [Pages].

Then, code the [FaxEmployment2] form (not in the report) to  open the
report hidden, read the [Pages] and then close the report.

DoCmd.OpenReport "ReportName", acViewPreview, , , acHidden
Me.[txtComputerPrintouts] = reports!ReportName.[Pages]
DoCmd.Close acReport, "ReportName"
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.