Table of Contents with SubReports

J

jhicsupt

Is there a way to do a table of contents that displays all of the subreports?

Example:

[RptSubform1] - Page 1
[RptSubform2] - Page 4
[RptSubform3] - Page 14

Thanks in advance.
 
S

strive4peace

Table of Contents for Report
~~~

try this:

Make the following table in your database

RptPages
- RptPageID, autonumber
- SubReportName, Text
- FirstPage, integer

On your main report, make the following textbox control:
Name--> PageNo
controlSource --> =Page

in the ReportHeader section OnFormat event of the main report, clear
records that were already in the RptPages table

dim s as string
s = "DELETE * FROM RptPages;"
currentdb.execute s
currentdb.tabledefs.refresh
DoEvents

then, in the OnFormat event of the Report Header section of each subreport:

dim s as string
s = "INSERT INTO RptPages " _
& " SubReportName, FirstPage) "
& " SELECT 'YourReferenceName', " _
& me.parent.pageNo & ";"
currentdb.execute s
currentdb.tabledefs.refresh
DoEvents

Now your table will be populated when you get to the report footer...
use a subreport in the main Report Footer to show the information

~~~

have not tested this, but hopefully, you see the logic and can make
adjustments as needed <smile>


Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm

*
:) have an awesome day :)
*
 
Top