XL: "User-Defined Type Not Defined" Error Message Using DAOLast reviewed: February 27, 1998Article ID: Q145759 |
The information in this article applies to:
SYMPTOMSWhen you run a Microsoft Excel Visual Basic for Applications subroutine using data access objects (DAO), you may receive one of the following compile errors:
User-Defined Type Not Defined -or- Sub or Function Not Defined CAUSEYou may receive the error message when a subroutine contains code that uses the Microsoft DAO Object Library, and the library is not referenced.
RESOLUTIONIn order to avoid the error message, perform the following steps.
Microsoft Excel 7.0
Microsoft Excel 97
MORE INFORMATIONWhen you run a subroutine using DAO, and the DAO Object Library is not referenced, you receive one of the messages list above, depending on what code is written. If your code declares variables, for example
Dim Db as Database Dim Rs as Recordsetyou receive the "User-Defined Type Not Defined" message, and the subroutine fails in the variable declaration section. If you did not declare your variables, you receive the "Sub or Function Not Defined" error message, and the subroutine fails at the first use of a statement that requires the DAO Object Library. This line is usually:
Set Db = Workspaces(0).OpenDatabase(Path, <optional arguments>)In this case, the subroutine fails when it encounters "Workspaces."
|
Additional query words: 7.00 8.00 97 XL97
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |