User Defined Type not Defined

L

Leonard

I have some VBA code that starts with "Dim dbs As
Database" I copied this code to a new database VBA
module and get a "User Defined type not Defined" error.
Access help says to go to References and select the
appropriate library. But the references selection in hte
drop down menu is not available after I add this code to
the file. This is the same code I have used on many
other files.
 
G

Gerald Stanley

You code must stop your code executing in order to access
the References.

Hope This Helps
Gerald Stanley MCSD
 
M

Marshall Barton

Leonard said:
I have some VBA code that starts with "Dim dbs As
Database" I copied this code to a new database VBA
module and get a "User Defined type not Defined" error.
Access help says to go to References and select the
appropriate library. But the references selection in hte
drop down menu is not available after I add this code to
the file.


You have to be in a code module or the debug window for the
References menu item to be available.

While you're in there and if you do not intend to use the
ADO library, uncheck that so that you don't have to deal
with ambiguous items that are in both the DAO and ADO
libraries. If you are using both ADO and DAO, then be sure
to disambiguate the objects in the libraries, e.g.

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim cn As ADODB.Connection
Dim rsx As ADODB.Recordset

Even if you're not using both libraries, it is good idea to
disambiguate them anyway, just in case you need to use the
ADO library at some future time.
 

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