Object types

M

Michelle

I am writting code for my Access 2000 form. I would like
to query the database and hold the results in a recordset
for further processing but the object types for Database
and Recordset are not available to me.

If I type:
Dim x As Database

I get the following error:
Microsoft Visual Basic
Compile Error:
User Defined Type not defined

Do I need an Add-in? If so, my Add-in Manager is empty.
Where do I get Add-in's from?

Thank you for your help,
Michelle
 
D

Dirk Goldgar

Michelle said:
I am writting code for my Access 2000 form. I would like
to query the database and hold the results in a recordset
for further processing but the object types for Database
and Recordset are not available to me.

If I type:
Dim x As Database

I get the following error:
Microsoft Visual Basic
Compile Error:
User Defined Type not defined

Do I need an Add-in? If so, my Add-in Manager is empty.
Where do I get Add-in's from?

Thank you for your help,
Michelle

You need to add a reference to the Microsoft DAO 3.6 Object Library. In
the VB Editor, click Tools -> References..., locate this reference in
the list, and put a check mark in the box next to it. There's a
potential for conflict with the ADO library, so if you're not using ADO,
remove the check mark next to Microsoft ActiveX Data Objects 2.x Object
Library. If, on the other hand, you do want to use ADO as well as DAO,
declare your objects with the library qualifier; e.g.,

Dim db As DAO.Database
Dim rs As DAO.Recordset
 
S

Steve Schapel

Michelle,

Go to Tools|References menus from the VBE window. You will need to
have the 'Microsoft DAO 3.6 Object Library' selected in order to use a
Database object. DAO is not referenced by default. If you need to
also have a reference to ADO, then your declarations in your code
should explicitly refer to the library for the Recordset object, as
this is included in both libraries, e.g.
Dim x As Database
Dim y as DAO.Recordset

- Steve Schapel, Microsoft Access MVP
 
M

Michelle

Dirk,
Thank you so much for your timely and accurate help!
Do you know of a good source that explains what all of
those reference libraries have to offer. For instance,
how would I know that Microsoft DAO 3.6 is the one that I
needed?

Thanks again,
Michelle
 

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