Brett Barabash
BBarabash at TappeConstruction.com
Thu Jul 24 09:54:59 CDT 2003
Here's what I did to create a table of contents on one of my reports: - Include a textbox on the report, bound to =[Pages]. It doesn't have to be visible. - Access will then roll through the entire report before the first page is actually printed/previewed. - In the Page footer format event, check to see if Me.Pages = 0 - If =0, capture the page group info. - If <>0, display the page count. Here is an example, assuming a report that groups page counts based on Customer ID: Private mlngPgGrp() As Long Private mlngIdx As Long Private mlngCustID As Long Private Sub Report_Open(Cancel As Integer) 'Determine how many page groups there are going to be ReDim mlngPgGrp(1 To DCount("*","sqryCustomers")) End Sub Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer) If Me!CustomerID <> mlngCustID Then 'Different Customer ID; advance counter If mlngIdx = UBound(mlngPgGrp) Then 'End of array; Roll back to start of list mlngIdx = 1 Else mlngIdx = mlngIdx + 1 End If mlngCustID = Me!CustomerID End If If Me.Pages = 0 Then 'Pre-format stage; collect grouping info mlngPgGrp(mlngIdx) = mlngPgGrp(mlngIdx) + 1 Else Me!tbxPageCnt = "Page " & Me.Page & " of " & mlngPgGrp(mlngIdx) End If End Sub If you'd like more info with specific examples for your situation, let me know. -----Original Message----- From: Gustav Brock [mailto:gustav at cactus.dk] Sent: Thursday, July 24, 2003 9:31 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Page numbers Hi Bobby Your problem is that you don't have the page count for each contract and you can only obtain those reliably by printing or previewing the report until last page. You could do that by printing the report to a dummy file while collecting the page counts into a temporary table; then join this table to the query of the report and do the real printout - lots of potential fun here! /gustav > Have a report that ideally prints on one page per contract, but many times > could spill over to 2 or 3 pages for the contract. The client wants me to > put page numbers like so: > page 1 of 1 > page 1 of 2 | 2 page report > page 2 of 2 | here > page 1 of 1 > page 1 of 1 > page 1 of 2 | 2 page report > page 2 of 2 | here > etc. > I am not sure on how to go about doing this. Any ideas? I know that I can > reset the Page variable, but I do not think that I can reset the Pages > variable. > I am using Access 97 on Win 2k. > Thanks, > Bobby _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -------------------------------------------------------------------------------------------------------------------- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the originator of the message. This footer also confirms that this email message has been scanned for the presence of computer viruses. Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of Tappe Construction Co. Scanning of this message and addition of this footer is performed by SurfControl E-mail Filter software in conjunction with virus detection software.