VB

Z

ZH

Please can you help. I am not familiar with VB and
require some assistance in creating a module in access.

I am creating a "Table of Contents" for a report as
described in Knowledge base article 210269
linked here:

http://support.microsoft.com/default.aspx?scid=kb;en-
us;210269

The instructions work fine when using the Northwind
example DB, but in my own DB when trying to compile the
Module. I get the below error,

Compile error: User defined type not defined

This applies to the following lines

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

Please can you explain how I can resolve this.

Many thanks
 
C

Cheryl Fischer

Do you have a reference set to the Microsoft DAO 3.6 Object Library (Access
2000 and newer) or Microsoft DAO 3.51 Object Library (Access 97)?
 
G

Guest

Hi

thanks for your reply. I am new to this so don't know
where i can check this. If it isn't set how can I do
this? I am using Access 2000.


Thanks again
 
C

Cheryl Fischer

Here is how:

1. With your database open, press Alt-F11
2. This opens a VB code window
3. From the VB menu, select Tools|References
4. If you do not have a checked reference to Microsoft DAO x.xx Object
Library, scroll through the list of available references until you find the
DAO reference appropriate to your version of Access.
5. Place a check in the box to the left of the reference
6. Click OK

With the VB code window still open, select Debug|Compile.
 
N

Nick Coe

-----Original Message-----
Please can you help. I am not familiar with VB and
require some assistance in creating a module in access.

I am creating a "Table of Contents" for a report as
described in Knowledge base article 210269
linked here:

http://support.microsoft.com/default.aspx?scid=kb;en-
us;210269

The instructions work fine when using the Northwind
example DB, but in my own DB when trying to compile the
Module. I get the below error,

Compile error: User defined type not defined

This applies to the following lines

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

Please can you explain how I can resolve this.

Many thanks
.
 
N

Nick Coe

Lost my message somehow...

Oh well...

Just noted that there's a Dim missing from your reported
vba. Might be a typo in the message or in your code,
worth checking...

qd As DAO.QueryDef
Should be
Dim qd As DAO.QueryDef

Nick Coe, Lincoln UK
Accessing for far too long...
 

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