Home > Software engineering >  Compile error: User-defined type not defined when updating an older macro for Access library
Compile error: User-defined type not defined when updating an older macro for Access library

Time:06-08

Updating an older macro that referenced Microsoft DAO 3.6 Object Library. I've switched out that reference for Microsoft Access 16.0 Object Library, but I'm still getting the error "Compile error: User-defined type not defined" on the first line. What else do I need to do to reference the correct library?

Dim dbExternal As DAO.Database
Dim rsTmp As DAO.Recordset
Dim qdfTmp As QueryDef


Dim oConn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim Query As String

Set oConn = New ADODB.Connection
Set rs = New ADODB.Recordset

List of References

CodePudding user response:

You didn't say what version or show a list of references you have so it's hard to know exactly

But my suspicions are that you have Access 2016 or Office 365

You then need to add the reference for

Microsoft Office 16.0 Access Database Engine Object Library

Missing Reference

And its also possible you're also missing the ADODB reference

Microsoft ActiveX Data Objects 6.1 Data Library

  • Related