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

Last reviewed: March 12, 1998
Article ID: Q182342
The information in this article applies to:
  • Microsoft Access versions 7.0, 97

SYMPTOMS

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

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 in the "Symptoms" section.

  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 the 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 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

  1. Create a module and type the following procedure:

          Function Test()
    
             Dim db as Database
          End Function
    
    

  2. On the Tools menu, click to clear the Microsoft DAO Object Library.

  3. 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.


Additional query words: prb
Keywords : MdlDao PgmOthr
Version : WINDOWS:7.0,97
Platform : WINDOWS
Hardware : x86
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 12, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.