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

User-defined type error

Status
Not open for further replies.

lb1

Technical User
Apr 19, 2002
109
US
In Excel VBA, I have a piece of code :
...
Dim l_rsTable As Recordset
Dim l_dbDatabase As Database
Dim l_wsWorkSpace As Workspac etc..

When I run the code I get the following error:

"User-defined type not defined"

I believe that I need to 'Add-in' a specific module but which one? I loaded the ODBC already.
Thanks for any help
 
Hi!

I'm not sure how it applys to excel 97, but in 2000+, you need to have the references to the Microsoft DAO 3.N Object Library (N = numeric, possibly 6).

How: In any module, hit Tools | References, find the mentioned library, and check it. If it's alredy checked, you might try to change the priority (put it higher on the list).

It would also be recommended in 2000+ versions to change the declaration to:

[tt] Dim l_rsTable As DAO.Recordset
Dim l_dbDatabase As DAO.Database[/tt]

HTH Roy-Vidar
 
I do have Excel 2000 but I cannot see References in Tools>

Any reason?
 
Oups - in a module, not in excel, hit ALT+F11 to toggle to a module, then you'll find it...

Roy-Vidar
 
I did this one day but couldn't remember.
Thanks
Louis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top