DAO Error Opening Recordset: "User-defined Type Not Defined"

  • Thread starter Thread starter millardgroups
  • Start date Start date
M

millardgroups

Can you help me understand why Acccess 2003 is having trouble opening a
recordset using the following code? I've copied this almost exactly out
of a book and checked its format against other books and the help file.
It seems right, but Access keeps stopping at the database definition,
saying, "User-defined Type Not Defined."

Here's the code:

Dim dbInfo As Database
Dim rstMaster As dao.Recordset

Set dbInfo = CurrentDb()

'Open the recordset
Set rstMaster =
dbInfo.OpenRecordset("tblLeadershipMaster_FanChartData", dbOpenDynaset)

Access doesn't seem to be recognizing any of the DAO stuff.

Can you help?
 
In your VBA editor; select Tools... References;

Scroll down and find "Microsoft DAO x.xx Object Library"... choose the
highest version and check it. That should solve your problem.
 
A user defined data type is an array of variable(s). The application presumes
you wrote a new datatype called Database, because it does not recognize
Database as a data type. Therefore, that data type called Database is not
defined.
 
I'd have expected that with Access 2000 or Access 2002, but Access 2003 is
supposed to have a DAO reference set by default.

In any case, go into the VB Editor, select Tools | References from the menu,
scroll through the list until you find the reference to the Microsoft DAO
3.6 Object Library and select it.
 
Thanks to all three of you for such fast responses! Zach and Doug...
that solution worked great.
 

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

Back
Top