Microsoft KB Archive/182342

= ACC: "User-defined Type Not Defined" Error Message =

Article ID: 182342

Article Last Modified on 1/22/2007

-

APPLIES TO


 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q182342



Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
When you compile or run code, you may receive the following error message:

Compile Error: User-defined type not defined.



CAUSE
You are referring to an object in an object library that you do not have referenced.



RESOLUTION
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:


 * 1) Open any module in the database that is generating the error described in the "Symptoms" section of this article.
 * 2) On the Debug menu, click Compile All Modules. Note the line of code that is highlighted when you receive the error message.
 * 3) On the Tools menu, click References.
 * 4) Click to select the object library that contains the object referenced by the line of code that is highlighted.



MORE INFORMATION
One of the most common object libraries that may cause the error described in the "Symptoms" section if it is not referenced is the Microsoft DAO Object Library. If the reference is missing, you may receive this error on many common DAO commands such as:

Dim db as Database

If you receive this error on a common DAO object, you need to add the appropriate reference for your version of Microsoft Access:

In Microsoft Access 97: Microsoft DAO 3.5 Object Library

In Microsoft Access 7.0: Microsoft DAO 3.0 Object Library

NOTE: If you are using the older versions of DAO objects, methods, and properties in your application, you must establish a reference to the Microsoft DAO 2.5/3.x compatibility library instead.

Steps to Reproduce Behavior
  Create a module and type the following procedure:

Function Test Dim db as Database End Function  On the Tools menu, click to clear the Microsoft DAO Object Library. To test this function, type the following line in the Debug window, and then press ENTER.

?Test

Note that you receive the error message mentioned in the "Symptoms" section.

Keywords: kbprb KB182342

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.