We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Referece set to ADO 2.8 but declaring ADODB causes error "User-Defined type not defined.

DanT4Syncro
DanT4Syncro asked
on
Medium Priority
304 Views
Last Modified: 2008-02-01
I have set a reference to msador15.dll and started to write a function as follows.

    Dim cnn As ADODB.Connection
    Set cnn = New ADOR.Connection

I then tried to compile this to check I was on the right path and I get the message "User-Defined Type not defined"

I have searched MSDN, here and some other forums but am still lost. Most examples suggest setting a reference to ADOn.n and thats what I have done.

I have tried referencing msadomd.dll and the ADO ext. 2.7 for dll and secuiity niether have helped me out.

Am I missing a simple trick or am I heading along the wrong path in the wrong woods?

Many thanks

Dan T
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2010

Commented:
Hi DanT4Syncro,
> Set cnn = New ADOR.Connection

Don't you mean:

    Set cnn = New ADODB.Connection

?

Regards,

Patrick

Author

Commented:
Hi Patrick,

Many thanks for your reply and making me realise I made a mistake typing that out.

This is what I have that causes the error when I try to compile

    Dim cnn As ADODB.Recordset
    Set cnn = New ADODB.Recordset

The first line is highlighted from cnn onwards.

Also to clarify I am using Access 2003  

Regards,

Dan T

Author

Commented:
Some additional information

When I set the reference to the msador15.dll the reference is titled. "Microsoft ActiveX Data Objects RecordSet 2.7 Library". If I return to the references again the msador15.dll reference now shows as being "Microsoft ActiveX Data Objects RecordSet 2.8 Library"

Does this have any significance?
Scott McDaniel (EE MVE )Infotrakker Software
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
With the reference you've got set, your syntax would be this:

Dim cnn As ADOR.Recordset

You should instead NOT have a reference to the "Microsoft ActiveX Data Objects RecordSet 2.7 Library" (unless you have a need for it), but instead set a reference to the "Microsoft Activex DataObjects 2.x Library" and do away with the Recordset 2.7 Library reference ...

Author

Commented:
Thanks for the reply.

The reference you suggest is the reference I originally started out looking for. However in my list of references I can see the following:

"Microsoft ActiveX Data Objects RecordSet 2.7 Library"                          File name "msador15.dll"
"Microsoft ActiveX Data Objects (Multi-dimensional) 2.7 Library"             File name "msadomd.dll"
"Microsoft ADO ext. 2.7 for DDL and security"                                        File name "MSADOX.dll"

I have trawled through all the references that start with an "M" and there isn't a reference for

"Microsoft Activex DataObjects 2.x Library"

Could it be I need to browse and add the correct reference? If so is there a filename I should be looking for?

Many thanks again

Dan
Infotrakker Software
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
No, if you're not showing any of the "Microsoft ActiveX Data Objects xx Library" references, you may very well have some problems with MDAC, and you cannot simply reference a single file ... MDAC is very complex (and HUGE) and you must do a reinstall if you have troubles..

FWIW: I'm showing about 6 different versions of this library, as well as the other 3 references you mention.

Perhaps download the ComponentChecker from MS and see exactly what version of MDAC you're running:

http://msdn.microsoft.com/data/mdac/downloads/default.aspx

Your version of MDAC depends on many different things, but the CC tool should be able to determine exactly which version you're running, and should be able to detect problems with your MDAC install.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Many thanks for you reply again. I shall do as you suggest and let you know what the score is.

Regards,

Dan

Commented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: LSMConsulting {http:#16328882}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

jjafferr
EE Cleanup Volunteer
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.