Defining Database data type

G

Guest

I am using the following code and get the error below. I tried removing DAO.
and tried ADODB.Database but I get the same error. Any help is appreciated.
I am using Access 2002 with an Access 2000 file format.

Option Compare Database
Option Explicit
Private Sub Command4_Click()
Dim db As New DAO.Database

Compile error:
User-defined type not defined
 
A

Alex Dybenko

First - you have to make sure that a reference to DAO exists, it is required
in this case
second - you have to declare as:

Dim db As DAO.Database

and then either open database, ot create it using CreateDatabase method
 
G

Guest

How do I create a reference to DAO? I tried creating a connection, but that
did not seem to do it. Thanks
 
G

Guest

I figured out how to create a reference by using the VB window and selecting
Tools References MS DAO 3.6
 

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