Jim Dettman
jimdettman at earthlink.net
Thu Apr 14 08:00:31 CDT 2005
Rocky, <<" When you preview the report, page through all of the pages of the report to make sure that the Print event is triggered for all records. " which is not practical. That's OK if I'm running it myself but not for an end user.>> I haven't read the article yet, but the article is wrong. By referencing the pages property within a control (which can be hidden), the report engine is forced into two pass mode. It first does a dry run of the entire report without printing. It is important to note that the OnPrint events are by-passed on this dry run, so any logic for capturing page numbers or modifying the layout must be in the OnFormat events.. I just worked on a college transcript problem for someone where a column footer needed to be placed at the end of each column. Here's the resulting code from the term footer OnFormat event. This used the two pass technique and saved the footer location for each footer to a table. A message was displayed based on whether or not additional footers remained to be printed it's location. The code is shown below. Jim. If FormatCount = 1 Then ' Try and find the footer. rstFooterInfo.Seek "=", varLastSYVRTRN_INSTIT_TRANSFER, varLastSYVRTRN_SBGI_CODE, varLastSYVRTRN_TERM_CODE If rstFooterInfo.NoMatch Then ' Save the footer info rstFooterInfo.AddNew Else rstFooterInfo.Edit End If rstFooterInfo![SYVRTRN_INSTIT_TRANSFER] = varLastSYVRTRN_INSTIT_TRANSFER rstFooterInfo![SYVRTRN_SBGI_CODE] = varLastSYVRTRN_SBGI_CODE rstFooterInfo![SYVRTRN_TERM_CODE] = varLastSYVRTRN_TERM_CODE rstFooterInfo![PageNumber] = Me.Page rstFooterInfo![ColumnNumber] = IIf(Me.Left < 3000, 0, 1) rstFooterInfo.Update ' Format the continue message ' Is there another footer in front of us? rstFooterInfo.Seek ">", varLastSYVRTRN_INSTIT_TRANSFER, varLastSYVRTRN_SBGI_CODE, varLastSYVRTRN_TERM_CODE If rstFooterInfo.NoMatch Then ' This is the last footer txtContinuation.Value = "" Else ' We have something more to print ' which column is the next footer in? If rstFooterInfo![PageNumber] = Me.Page And rstFooterInfo![ColumnNumber] = IIf(Me.Left < 3000, 0, 1) Then ' Next section is within the same page and col. ' No message txtContinuation.Value = "" Else If rstFooterInfo![ColumnNumber] = 0 Then ' We must be in the right column right now txtContinuation.Value = "********************* CONTINUED ON PAGE " & rstFooterInfo![PageNumber] & " *********************" Else ' We are in the left column txtContinuation.Value = "****************** CONTINUED IN NEXT COLUMN *******************" End If End If End If End If -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin - Beach Access Software Sent: Wednesday, April 13, 2005 2:21 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Page numbers for table of contents in an access report Jim: Thank you. That looks promising. However, it says: " When you preview the report, page through all of the pages of the report to make sure that the Print event is triggered for all records. " which is not practical. That's OK if I'm running it myself but not for an end user. And I don't want to print it twice. The page number is tracked in a counter that gets incremented in the page footer event. So until the report is printed once there's no way to know what page a given record is on. Is there a way to print without actually printing? Thanks and regards, Rocky Smolin Beach Access Software http://www.e-z-mrp.com 858-259-4334 ----- Original Message ----- From: "Jim Dettman" <jimdettman at earthlink.net> To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> Sent: Wednesday, April 13, 2005 11:06 AM Subject: RE: [AccessD] Page numbers for table of contents in an access report > Rocky, > > You need to force 2 pass mode, then save the descriptions and pages to a > table on the first pass. See the following MSKB article: > > ACC2000: How to Create a Table of Contents or Index for a Report > http://support.microsoft.com/?kbid=210269 > > Jim. > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin - > Beach Access Software > Sent: Wednesday, April 13, 2005 1:55 PM > To: AccessD at databaseadvisors.com > Subject: [AccessD] Page numbers for table of contents in an access > report > > > Dear List: > > I would like to insert a table of contents into a rather lengthy report > which can vary in its content. > > The content is actually printed in two subreports. > > Is there some way to know what page a detail record is on so that a table > of > contents could be generated and inserted into a report. > > MTIA > > Rocky Smolin > Beach Access Software > http://www.e-z-mrp.com > 858-259-4334 > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com