We have an existing database using the InitToc() Function and UpdateToc() Function (see MS article Q131588). The statement:
"If toctable.nomatch then" along with the "End If" statement exists because when you open the report in print preview the first page of information is sent to the query and when you click on print all the other pages go to the query.
This If/Then statement prevents the data from page one from being duplicated but it also prevents any other duplicates such as names. I want the duplicate names as we have doctors that need to be in the Table of Contents for every page on which they appear. For instance, Dr. Jones may have offices in three locations so is on three different pages or Dr. Smith may specialize in Allergy and and also in Respiratory so he appears on two different pages but each one is only listed in the Table of Contents once.
If I remove the If/Then statement page one is listed twice. I've worked around this in the past by opening the query and deleting the contents between opening the report in print preview and actually printing the report but this is annoying.
I have been using the Table Of Contents for my database. I used a primary key value to pass to the Update TOC. You may want to consider this. You can use the unique key to pass through all of your records and display them all due to they will not match, and include in your query the Doctor's Names to be displayed on your report.
Also, as a side note you don't have to print the report to create the TOC. If you export the document to Word it will run through all of the pages and write out the TOC's if that is all you want.
Thanx much for the info. I've taken your advice and made the necessary changes to the tables and module involved. Unfortunately, with this added field the report, TOC and query comes up blank even though the correct number of records are displayed in the filter. Any more info would be appreciated!
Yes, the report box flashes by (if you blinked you wouldn't see it) and then nothing. So I go and look at the TOC and it is empty.
In the InitToc Function is
toctable.Index = "AccountNo"
and in the UpdateToc
TOCAccountNo as Long
toctable.Seek "=", TOCAccountNo
toctable!AccountNo = TOCAccountNo
The records will be sent to the TOC if I remove all reference to it in the module. And I mean all references. When the Index is "Member"
as well as the Seek statement and the Argument and other line are removed it works fine, except for the duplicate page one entries.
I'll understand if this is more than you bargained for so if I don't hear back from you have a great holiday weekend anyway!!