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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compile Error on Autoexec macro?? 1

Status
Not open for further replies.

quest4

Technical User
Aug 27, 2001
735
US
This is a strange one in deed. I have a dbase that I use an autoexec macro on with a public function, RunOncez() where I dim dbs As Database. I mase a second dbase for archiving some of the data from the first dbase. I imported the macro and the module from the first dbase to the second dbase and did not change any names. I just tried to open the second dbase and I get this error message:
"Compile error: User-defined type not defined" the debugger has the Dim dbs As Database hi-lited. Any ideas on this erroe? It works great in the first dbase, I can not understand why it doesn't work in the second dbase and no they are not in the same directory. Any ideas and hopefully solutions will be greatfully appreciated. Thanks in advance.
 
Hi!

You need to set a reference to the DAO library. Go to the VB window, select Tools - References. Find the reference to DAO 3.6 and check it. Now use the arrow keys and move the reference up until it is above the reference to the ADO object library. Alternatively to moving the DAO reference up, you can change your dim statements to read:

Dim dbs As DAO.Database and
Dim rst As DAO.Recordset

hth
Jeff Bridgham
bridgham@purdue.edu
 
Jeff, That did the trick. Thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top