Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2002 corrupted?

Status
Not open for further replies.

Greaser

Technical User
Aug 1, 2001
84
CA
Hi,
I have used the following declaration dozens of times:
Dim db As Database
Now, I get the following compile error:
"User-defined type not defined"
Any ideas?
Is Access corrupted?
Thanks,
John
 
Note that the same declaration still compiles in previous projects.
John
 
Have you set a reference to DAO? Access 2002 will by default use ADO, and the dim statement would be

Dim Db AS ADODB

HTH
Lightning
 
This doesn't work neither.
The questions are why do my earlier projects still compile this declaration and why did it stop compiling?
Cheers,
John
 
When I've encountered this problem in the past, it has always been a problem in referencing the DAO Object library. If you have both DAO and ADO object libraries referenced, check the order. Try moving the DAO object library so that it is higher in the list than the ADO Object Library. The ordewr in the list determines the priority of the Library.

HTH
Lightning
 
Note that Database, Databases and DAO do not appear in the types list that appears when declaring a variable.
 
There is no DAO Object Library in the object browser.
ADODB and Access are there. Database is not included in the classes window.
 
It looks like the DAO class dissapeared from the object library.
Can anyone tell me how to add it back in?
Thanks,
John
 
Open a code module in design mode, select Tools - References ... then click on then checkbox next to "Microsoft DAO 3.6 Object Library" .. and close the menus, and the module... you should be explicit when declaring your Database and Recordset variables....

Dim db as DAO.Database
Dim rs as DAO.Recordset

PaulF
 
Thanks to all who helped.
The problem was that some how, the DOA 3.6 reference was unchecked in the library. I checked it and moved it to its proper place. That did it.
Thanks again,
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top