C
Carol
I am definitely in over my head with this, and would greatly appreciate any
help.
As a volunteer for our local historical society, I have created a database
(Access 2000) for our cemetery, and a report of the names sorted by section,
row, and family plot name. Now I need an index to find the names (16,000+) in
this report.
Using this Microsoft article as a starting point:
http://support.microsoft.com/?kbid=210269 (How to Create a Table of Contents
or Index for a report), this is what I have:
I created a table: TableOfContents
Field Name: FullName
Data Type: Text
Indexed: Yes (No duplicates}
Field Name: PageNumber
Data Type: Number/Long Integer
Indexed: No
Here is the module:
Option Explicit
Dim db As DAO.Database
Dim TocTable As DAO.Recordset
Dim intPageCounter As Integer
Function InitToc()
Dim qd As DAO.QueryDef
Set db = CurrentDb()
intPageCounter = 1
Set qd = db.CreateQueryDef("", "Delete * From [TableOfContents]")
qd.Execute
qd.Close
Set TocTable = db.OpenRecordset("TableOfContents", dbOpenTable)
TocTable.Index = "FullName"
End Function
Function UpdateToc(TocEntry As String, Rpt As Report)
TocTable.Seek "=", TocEntry
If TocTable.NoMatch Then
TocTable.AddNew
TocTable!ID = TocEntry
TocTable![PageNumber] = intPageCounter
TocTable.Update
End If
End Function
Function UpdatePageNumber()
intPageCounter = intPageCounter + 1
End Function
-------------
I set OnOpen of rptCemeteryListing: =InitToc()
I set OnPrint of the header just above the listings for the names:
=UpdateToc([FullName],[Report])
I set OnPrint of the page footer: =UpdatePageNumber()
{One side note -- the text box on my report that I named FullName is
actually a formula of 4 fields. This is the information I am trying to get
into the Table of Contents field also named FullName.}
When I run the report, I get error message saying "FullName is not an index
in this table." I accidentally changed the code above to TocTable.Index =
"LName" (LName is a field in the formula to create FullName. It is also the
name of a field in a text box for the family plot name.
I'm stumped. Thank you so much for any help or advice, even bad jokes
comparing Access projects to tombstones.
help.
As a volunteer for our local historical society, I have created a database
(Access 2000) for our cemetery, and a report of the names sorted by section,
row, and family plot name. Now I need an index to find the names (16,000+) in
this report.
Using this Microsoft article as a starting point:
http://support.microsoft.com/?kbid=210269 (How to Create a Table of Contents
or Index for a report), this is what I have:
I created a table: TableOfContents
Field Name: FullName
Data Type: Text
Indexed: Yes (No duplicates}
Field Name: PageNumber
Data Type: Number/Long Integer
Indexed: No
Here is the module:
Option Explicit
Dim db As DAO.Database
Dim TocTable As DAO.Recordset
Dim intPageCounter As Integer
Function InitToc()
Dim qd As DAO.QueryDef
Set db = CurrentDb()
intPageCounter = 1
Set qd = db.CreateQueryDef("", "Delete * From [TableOfContents]")
qd.Execute
qd.Close
Set TocTable = db.OpenRecordset("TableOfContents", dbOpenTable)
TocTable.Index = "FullName"
End Function
Function UpdateToc(TocEntry As String, Rpt As Report)
TocTable.Seek "=", TocEntry
If TocTable.NoMatch Then
TocTable.AddNew
TocTable!ID = TocEntry
TocTable![PageNumber] = intPageCounter
TocTable.Update
End If
End Function
Function UpdatePageNumber()
intPageCounter = intPageCounter + 1
End Function
-------------
I set OnOpen of rptCemeteryListing: =InitToc()
I set OnPrint of the header just above the listings for the names:
=UpdateToc([FullName],[Report])
I set OnPrint of the page footer: =UpdatePageNumber()
{One side note -- the text box on my report that I named FullName is
actually a formula of 4 fields. This is the information I am trying to get
into the Table of Contents field also named FullName.}
When I run the report, I get error message saying "FullName is not an index
in this table." I accidentally changed the code above to TocTable.Index =
"LName" (LName is a field in the formula to create FullName. It is also the
name of a field in a text box for the family plot name.
I'm stumped. Thank you so much for any help or advice, even bad jokes
comparing Access projects to tombstones.