K
Kbrad32 via AccessMonster.com
Good Morning Everyone,
I am having trouble updating my Table of Contents report that I created using
KB article 210269. The is as follows:
Option Compare Database
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 Table of Contents table.
Set qd = db.CreateQueryDef("", "Delete * From [Table of Contents]")
qd.Execute
qd.Close
'Open the table.
Set TocTable = db.OpenRecordset("Table Of Contents", dbOpenTable)
TocTable.Index = "Description"
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!Description = TocEntry
TocTable![page number] = intPageCounter
TocTable.Update
End If
End Function
Function UpdatePageNumber()
intPageCounter = intPageCounter + 1
End Function
------------------------------------------------------> This is working fine,
but the report doesn't have the correct page number for each record. All the
pages just states the number 1 (one). Is there a to do this? Any help will be
greatly appreciated.
Thanks,
Kbrad32 ;c)
I am having trouble updating my Table of Contents report that I created using
KB article 210269. The is as follows:
Option Compare Database
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 Table of Contents table.
Set qd = db.CreateQueryDef("", "Delete * From [Table of Contents]")
qd.Execute
qd.Close
'Open the table.
Set TocTable = db.OpenRecordset("Table Of Contents", dbOpenTable)
TocTable.Index = "Description"
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!Description = TocEntry
TocTable![page number] = intPageCounter
TocTable.Update
End If
End Function
Function UpdatePageNumber()
intPageCounter = intPageCounter + 1
End Function
------------------------------------------------------> This is working fine,
but the report doesn't have the correct page number for each record. All the
pages just states the number 1 (one). Is there a to do this? Any help will be
greatly appreciated.
Thanks,
Kbrad32 ;c)