You can create your own data types in Visual Basic, but they must be defined first in a Type...End Type statement or in a properly registered object library or type library. This error has the following causes and solutions:
Use the Type statement in a module to define a new data type. If you are trying to create a reference to a class, the class must be visible to the project. If you are referring to a class in your program, you must have a class module of the specified name in your project. Check the spelling of the type name or name of the object.
Move the definition of the type to a standard module where it can be Public.
Display the References dialog box, and then select the appropriate object library or type library. For example, if you don't check the Data Access Object in the References dialog box, types like Database, Recordset, and TableDef aren't recognized and references to them in code cause this error.
For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).