ACC2000: "User-defined Type Not Defined" Error MessageID: Q202192
|
When you compile or run code, you may receive the following error message:
Compile Error: User-defined type not defined.
You are referring to an object in an object library that you do not have referenced.
You must add a reference to the object library that contains the object that you are using in code. To do so, follow these steps:
NOTE: This section references Microsoft DAO. DAO is not used in Microsoft Access projects (*.adp), but the same concepts regarding missing object libraries apply.
Not having a reference to the Microsoft DAO Object Library is one of the
most common reasons for the error described in the "Symptoms" section in Access databases (*.mdb). If the reference is missing, you may receive this error on many common DAO commands such as:
Dim db as DAO.Database
If you receive this error on a common DAO object, you need to add the
following reference:
Microsoft DAO 3.6 Object Library
Example 1: DAO Objects
Reference: Microsoft DAO 3.6 Object Library
Declaration: Dim myRecordset as DAO.RecordsetExample 2: ADO Objects
Reference: Microsoft ActiveX Data Objects 2.1 Library
Declaration: Dim myRecordset as ADO.Recordset
NOTE: By explicitly declaring the object as ADO or DAO, the position of the checked reference on the references list is not an issue.
Function Test()
Dim db as DAO.Database
End Function
?Test()
Note that you receive the error message mentioned in the "Symptoms"
section.For more information about ActiveX Data Objects (ADO), in the Visual Basic Editor, click
Microsoft Visual Basic Help on the Help menu, type "ActiveX Data Objects" in
the Office Assistant or the Answer Wizard, and then click Search to
view the topic.
Additional query words:
Keywords : kbdta MdlDao PgmOthr
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: May 18, 1999