I was wondering the same thing...I just looked in Kirt's description expanded (RTFM) and the instructors notes appear to be part of a fee-based curriculum. Probably worth it, I'm guessing, but it does appear to require a sign up.
Microsoft 365 Access gives a mismatch error if the text field in the ToC table has the same name as the report control supplying the text. Additionally, the ToC table must be recreated if the indexed text field needs a name change. The ToC needs only two functions. Below, ToC is the Table of Contents table with a text field "Visitor" & "Page number" integer field. Function UpdateToc(TocEntry As String, Rpt As Report, Page As Integer), the first argument is the report control feeding Visitor. Option Explicit Dim dbs As DAO.Database Dim qd As DAO.QueryDef Dim intPageCounter As Integer Dim TocTable As DAO.Recordset Function InitToc() 'Called from the OnOpen property of the report. 'Deletes contents & opens the table of contents table. Set dbs = CurrentDb() 'Delete all previous entries in Table of Contents table. Set qd = dbs.CreateQueryDef("", "Delete * From [ToC]") qd.Execute qd.Close 'Open the table. Set TocTable = dbs.OpenRecordset("ToC", dbOpenTable) TocTable.Index = "Visitor" End Function Function UpdateToc(TocEntry As String, Rpt As Report, Page As Integer) 'Called from the OnPrint property of any section header encompassing the desired control, e.g. 'Detail' TocTable.Seek "=", TocEntry If TocTable.NoMatch Then TocTable.AddNew TocTable![Visitor] = TocEntry TocTable![Page number] = Page TocTable.Update End If End Function
Hi Kirt - thanks for this tutorial. You make reference to the "Instructor Notes" for the module code. Can you advise where these can be found? Thanks.
I was wondering the same thing...I just looked in Kirt's description expanded (RTFM) and the instructors notes appear to be part of a fee-based curriculum. Probably worth it, I'm guessing, but it does appear to require a sign up.
Microsoft 365 Access gives a mismatch error if the text field in the ToC table has the same name as the report control supplying the text. Additionally, the ToC table must be recreated if the indexed text field needs a name change. The ToC needs only two functions. Below, ToC is the Table of Contents table with a text field "Visitor" & "Page number" integer field. Function UpdateToc(TocEntry As String, Rpt As Report, Page As Integer), the first argument is the report control feeding Visitor.
Option Explicit
Dim dbs As DAO.Database
Dim qd As DAO.QueryDef
Dim intPageCounter As Integer
Dim TocTable As DAO.Recordset
Function InitToc()
'Called from the OnOpen property of the report.
'Deletes contents & opens the table of contents table.
Set dbs = CurrentDb()
'Delete all previous entries in Table of Contents table.
Set qd = dbs.CreateQueryDef("", "Delete * From [ToC]")
qd.Execute
qd.Close
'Open the table.
Set TocTable = dbs.OpenRecordset("ToC", dbOpenTable)
TocTable.Index = "Visitor"
End Function
Function UpdateToc(TocEntry As String, Rpt As Report, Page As Integer)
'Called from the OnPrint property of any section header encompassing the desired control, e.g. 'Detail'
TocTable.Seek "=", TocEntry
If TocTable.NoMatch Then
TocTable.AddNew
TocTable![Visitor] = TocEntry
TocTable![Page number] = Page
TocTable.Update
End If
End Function
Doesn't work sadly.
Keep getting the Type Mismatch. Set it up Exactly as in vid.