VBA & Macro Problems

Fix the ADODB.Recordset User-Defined Type Error in Access VBA

Ayan MasoodAyan Masood Nov 25, 2026 868 views

Question details

Resolve an Access VBA user-defined type error involving an ADO Recordset declaration.

Fix the ADODB.Recordset User-Defined Type Error in Access VBA
Product
Microsoft Access VBA
Device & OS
not provided
Scenario
A database uses ADO Recordset objects and may also reference DAO objects.
Observed behavior
Access reports a user-defined type error, or an unqualified Recordset declaration may resolve to the wrong library.
Before you start

Open the affected database in Microsoft Access and identify the declaration that causes the error. Make sure you can open the VBA editor and access Tools > References.

Solution 1Recommended

Enable the ADO reference and qualify Recordset declarations

Use this solution when Access cannot recognize ADODB.Recordset or may confuse ADO and DAO Recordset types.

1
Open the VBA editor

In Access, press Alt+F11 to open the VBA editor for the affected database.

2
Enable the ADO library

Select Tools > References, check an available Microsoft ActiveX Data Objects library, such as Microsoft ActiveX Data Objects 6.1 Library, and click OK.

3
Declare and create the ADO Recordset

In the affected module, explicitly declare and instantiate the object: Dim rsArtifacts As ADODB.Recordset, followed by Set rsArtifacts = New ADODB.Recordset.

4
Qualify DAO declarations

In the same module, change any DAO Recordset declarations to use DAO.Recordset explicitly so they cannot be confused with ADO Recordsets.

5
Compile the project

In the VBA editor, select Debug > Compile to check whether the type error is resolved.

Enable the ADO reference and qualify Recordset declarations
Check missing references: If a reference is marked MISSING in Tools > References, resolve it before compiling. The available ADO library version can vary by installation.
Free Microsoft Office alternative

Work with Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for opening and editing common Microsoft Office files, making it easy to move everyday document work. It does not fix Access VBA references or replace Microsoft Access for running the database.

Use a familiar interface for everyday document and spreadsheet workOpen and edit compatible Microsoft Word, Excel, and PowerPoint formatsReview notes or documentation about your Access VBA code in documentsMove common Office files into a lightweight productivity suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does Access say ADODB.Recordset is a user-defined type that is not defined?

The project may be missing an ADO library reference. In the VBA editor, select Tools > References and enable an available Microsoft ActiveX Data Objects library.

How do I distinguish an ADO Recordset from a DAO Recordset?

Use ADODB.Recordset for an ADO object and DAO.Recordset for a DAO object in your declarations. Qualifying the types avoids ambiguity when both libraries are referenced.

Does the ADO library have to be version 6.1?

No. The available version depends on the installation. In Tools > References, select an available Microsoft ActiveX Data Objects library appropriate for the project.

How can I check whether the reference change worked?

After enabling the library and updating the declarations, select Debug > Compile in the VBA editor. Address any errors that Access identifies.