Create a TOC with multiple categories in a report

A

antmorano

Hello All-

I am trying to generate a Table of Contents for a retiree listing. I
can get the table to get only the names for the first plan. There are
like 8 different plans and each one become separated by plan and
fund. From Microsoft it says that the TOC is only created by
category. Does anyone know how I can get a complete table of contents
which includes all plans and funds. Here is the Module that I am
using.

Option Explicit

Dim db As DAO.Database
Dim TocTable As DAO.Recordset
Dim intPageCounter As Integer
Function InitToc()
'Called from the OnOpen property of the report.
'Opens the database and the table for the report.
Dim qd As DAO.QueryDef

Set db = CurrentDb()

'Resets the page number back to 1
intPageCounter = 1
'Delete all previous entries in TableOfContents table.
Set qd = db.CreateQueryDef("", "Delete * From [TableOfContents]")

qd.Execute
qd.Close

'Open the table.
Set TocTable = db.OpenRecordset("TableOfContents", dbOpenTable)

TocTable.Index = "Retiree Last Name"
End Function

Function UpdateToc(TocEntry As String, Rpt As Report)
'Call from the OnPrint property of the section containing
'the TableOfContents Retiree Last Name field.
'Updates the TableOfContents table.
TocTable.Seek ">", TocEntry

If TocTable.NoMatch Then
TocTable.AddNew
TocTable![Retiree Last Name] = TocEntry
TocTable![page number] = intPageCounter
TocTable.Update
End If
End Function
Function UpdatePageNumber()
intPageCounter = intPageCounter + 1
End Function


- Thanks a lot I really appreciate this.

-Anthony Morano
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top