Results 1 to 2 of 2
Thread: compile error (A2002)
2003-10-28, 10:23 #1
- Join Date
- Jul 2002
- Cedar Falls, Iowa, USA
- Thanked 0 Times in 0 Posts
compile error (A2002)
I'm getting the following compile error:
User-defined type not defined
The problem code is:
Dim dbMdb As Database, prp As Property
Background: Found a great calculator control in A2000. It works great in A2000 and, when I converted to A2002 still worked. It was only after I Imported the autokey, module and the form into another A2002 database that I had a problem. Any ideas?
2003-10-28, 10:41 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
Re: compile error (A2002)
Activate the Visual Basic Editor
Select Tools | References...
Locate and tick "Microsoft DAO 3.6 Object Library"
This reference was present in the original database, and if you convert, the reference will come with it. But by default, this reference is not set in an Access 2000 or higher database, and importing a form will not import references.
I recommend that you prefix the declarations with DAO. :
Dim dbMdb As DAO.Database, prp As DAO.Property
This makes explicit to which libarary these objects belong, and it can prevent confusion. For example, Property is both a DAO and an ADO object, and the same holds for Recordset.