Report Index Does Not List All Names

A

antmorano

I am trying to create an index for a retiree listing that we have
(1600+) however when I open my report to polulate the results for the
TableOfContents table- the only names listed are the ones for the top
of each page. Here is the module that I used from Microsoft. Any
input would be appreciated.

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 Table Of Contents Retiree Last Name field.
'Updates the Table Of Contents 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


-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