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
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