How can I get a table of contents

G

Guest

I am rather new with access and I have a need to generate a table of contents
and an index for a report I am working on. I found the below article and
entered the code as indicated in the article.

After entering the code, I compiled it and got an error message
"User-defined type not defined". I get this error message as it relates to
the following lines:

Dim db As DAO.Database
Dim TocTable As DAO.Recordset

I get the same error message with respect to:

Dim qd As DAO.QueryDef

There appears to be a theme here connected with DAO.
 
G

Guest

Ok I was able to figure out how to avoid the below problem. The "Help"
message lead me to the Reference dialog box where I checked the DOA library.
However now I run the code and it errors out at line

"Set TocTable = db.OpenRecordSet ("Table of Contents", dbOpenTable)

Apparently it won't open the table. Since there is no on-line help for this
I going to need to rely on you guys/gals.
 
M

Marshall Barton

If the table is linked to a back end database, then you can
not open it using dbOpenTable. Try using dbOpenDynaset
instead.
 
G

Guest

Yes I have split the data from the application. I used your suggest and
inserted "dbOpenDynaset" in place of "dbOpenTable" but my Table of Contents
table did not update. Not sure what the problem could be now. I didn't get
any messages when the code ran.

Marshall Barton said:
If the table is linked to a back end database, then you can
not open it using dbOpenTable. Try using dbOpenDynaset
instead.
--
Marsh
MVP [MS Access]

Ok I was able to figure out how to avoid the below problem. The "Help"
message lead me to the Reference dialog box where I checked the DOA library.
However now I run the code and it errors out at line

"Set TocTable = db.OpenRecordSet ("Table of Contents", dbOpenTable)

Apparently it won't open the table. Since there is no on-line help for this
I going to need to rely on you guys/gals.
 
M

Marshall Barton

I'm not familiar with the code you are using and have no
idea why it's not doing what you want. Try formulating a
new question and starting a new thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top