User-defined type not defined

A

Ayo

I am getting the above error in the following lines of code. Any ideas?

Dim RST As DAO.Recordset
Dim DB As DAO.Database
Dim wrkMain As Workspace
Dim WS As DAO.Workspace
 
D

Douglas J. Steele

Go into Tools | References and check that you've got a reference set to the
Microsoft DAO 3.6 Object Library (i.e.: check that it's one of the ones at
the top of the list with checkmarks beside it.) If not, scroll through the
list until you find that entry, select it, then back out of the dialog.

If you already have that reference set, make sure that none of the other
selected references have MISSING: in front of them. If any of the selected
references do have "MISSING:" in front of them, unselect them, and back out
of the dialog. If you really need the reference(s) you just unselected (you
can tell by doing a Compile All Modules), go back in and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)
 
B

Beetle

Open a code window, go to Tools/References and make sure that the
Microsoft DAO object library is checked.
 
L

Larry Linson

Ayo said:
I am getting the above error in the following lines of code. Any ideas?

Dim RST As DAO.Recordset
Dim DB As DAO.Database
Dim wrkMain As Workspace
Dim WS As DAO.Workspace

Just a side question... why did you feel it necessary to disambiguate one
declaration of a Workspace object as DAO.Workspace but not the other? I
would agree with the other responders that your problem likely lies in
References. The other common cause of this error is a mis-spelled type, but
that does not appear to be the case here.

Larry Linson
Microsoft Office Access MVP
 

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