Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can this be done? (a tough report)

Status
Not open for further replies.

dusteater

Programmer
Aug 15, 2001
13
US
I have a report that I want to print a table of contents at the beginning of the report. I have found a way to do this but it involves printing the main report and then printing a seperate cover page for the table of contents. The only way I have been able to get this to work is to create a table to store the table of contents data in. This data is generated when the report is previewed or printed. The only way I can think of generating this data is to put code into the On_Print event of the group header. The Table of Contents data is not generated until all the pages are previewed. Is there a way I can preview all the pages and then go back to the first page with code? I tried the gotopage method but I couldn't get it to work, maybe I wasn't paying attention since I was tired...is there a way to do this? Or any other ideas??
Thanks
Rick
 
All of the soloutions I know of for this require a two pass process, and are fraught with pitfalls. The most obvious issue is having some process alter the recordsource for the report between the passes. This is easily overcome by creating the recordsource from a maketable query prior to the generation. Then, as you have already found, you need to "run'" the report and have some function within the report generate (or update/replace) the content of your TOC table. Next, Generate the TOC as a subreport placed in the REPORT Header. On the first Group heeader, reset the page # and it is (more-orless) done.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
MichaelRed,
I don't have a problem doing a two pass process. It won't affect the recordsource. If you could, please elaborate on how I might "Run" the report one time without it actually printing. I was trying to view the report and in code show each page but I couldn't get the gotopage method to work. I thought of "printing" to another device first( like the hard drive) but I haven't figured out how or if the TOC table will get updated with this print event. I have the code working for generating the TOC table but for it to work all the pages need to be "printed" to fully update the table. If I can get the report to "Print" without printing then I have it all worked out. Thanks for your help!
Rick
 
AFAIK, the "GotoPage" only applies to FORMS, NOT reports.

It has ben a while, so my memeory (or even the way Ms. Access does her thing) may be different from today's reallity, but I only recall doing the report thinngy with acPreview - and all of the page numbers were generated properly for the REPORT BODY. But that is the why you need to reset teh page number after the report header.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top