Mitsules, Mark S. (Newport News)
Mark.Mitsules at ngc.com
Mon Mar 15 12:43:04 CST 2004
>> Mark, I would be interested in how you generated the table of contents
from your report. Could you give a brief overview of what you did and/or
sample code? <<
>> Mark, I would also be interested in how you did this....Thanks, Barb <<
This began in a thread titled "A2K2 - Report Grouping - Page Numbering". I
was searching for a method to generate custom page numbering. Jim Dettman
was able to push me in the right direction. That thread will provide all
the background as well as the code I utilized. Essentially, the page
numbers are generated programmatically each time the report is run. The
page numbers are fed into text boxes in the page footer during the
PageFooterSection_Format event. Once the report matured to a "ready to
issue" state, I utilized the On Page event (posted again below...watch for
line wrap) to write the Group Header items and corresponding page numbers to
a file, thus creating a table of contents.
I must retract an earlier post where I indicated utilizing the "Print to
File" option to generate a Table of Contents. Initially, I recall wanting
to utilize that option, because, of course, it would be faster. However,
after re-reading some of my earlier posts, I now remember that it was
because of the inherit speed differences between running the code and
writing to a text file, the page numbers could not keep in sync. The
work-around was to call the report up in preview mode and manually page
through the report. Sorry for the mis-direction.
Probably clear as mud by now, so please ask for clarification if needed.
Mark
' *****************************************************
' *** FOR THE FINAL PRINT ***
' *** REMOVED THE ON PAGE EVENT THAT BUILDS THE TOC ***
' *****************************************************
'Private Sub Report_Page()
' Dim strOutputFile As String
' Dim strPath As String
'
' strPath = "C:\Temp2\"
' strOutputFile = "DA4700-3808_PageNumbers.txt"
'
' Open strPath & strOutputFile For Append As #2
'
' 'IOQSXZ are intentionally removed from the list below.
' strPageNumber = Trim(Format$(intMajor, "###") & Mid$("
ABCDEFGHJKLMNPRTUVWY", intMinor, 1))
'
' Write #2, strLeadDesignation & " " & strPageNumber
' Close #2
'
'End Sub