Compile Error - ADODB.Recordset Error "User-defined type not defined"

Compile Error - ADODB.Recordset Error "User-defined type not defined"

Post by CES » Wed, 28 Mar 2007 03:50:43


All,
I'm at a total loss, I've used this connection syntax forever and have never had a problem but I'm now not able to get this to work in Access 2007(Vista).

The error Compile Error ("User-defined type not defined") points to "Dim rst As ADODB.Recordset" below you will find offending code:

Public Function ValidateUser()

Dim rst As ADODB.Recordset
Dim strSQL As String

End Function

I saw a post that indicated I might have to set a reference using Tools\References\Available References, however I'm not exactly sure which one I should check as there are 9 variations of "Microsoft ActiveX Data Objects" FYI - the only objects that are checked under available references are:

Visual Basic for applications
Microsoft access 12.0 object Library
OLE automation
Microsoft office 12.0 access database engine objects library

Any help on this would be appreciated. Thanks in advance. - CES
 
 
 

Compile Error - ADODB.Recordset Error "User-defined type not defined"

Post by Douglas J. » Wed, 28 Mar 2007 04:17:16

In previous versions of Access, using ADODB required a reference to the
Microsoft ActiveX Data Object 2.x Library. I would assume it's no different
in Access 2007.

Microsoft office 12.0 access database engine objects library is the
equivalent of DAO, not ADO.

--
Doug Steele, Microsoft Access MVP
http://www.yqcomputer.com/
(no e-mails, please!)