Changed the line to what microsoft has and still the same error... Doesn't seem to understand where the inittoc is.
Yes Case_Name is a field instead of description.
Option Explicit
Dim db As Database
Dim toctable As Table
Function InitToc()
' Called from the OnOpen property of the report.
' Opens the database and the table for the report.
Dim qd As QueryDef
Set db = CurrentDb()
' Delete all previous entries in the Table of Contents table.
Set qd = db.CreateQueryDef _
("", "Delete * From [Table of Contents]")
qd.Execute
qd.Close
' Open the table.
Set toctable = db.OpenTable("Table Of Contents")
toctable.Index = "Case_Name"
Exit Function
End Function
Function UpdateToc(tocentry As String, Rpt As Report)
' Call from the OnPrint property of the section containing
' the Table Of Contents Description field. Updates the Table Of
' Contents table.
toctable.Seek "=", tocentry
If toctable.NoMatch Then
toctable.AddNew
toctable!Case_Name = tocentry
toctable![page number] = Rpt.Page
toctable.Update
End If
End Function