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

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
DanT4SyncroAsked:
Who is Participating?
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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.
0
 
Patrick MatthewsCommented:
Hi DanT4Syncro,
> Set cnn = New ADOR.Connection

Don't you mean:

    Set cnn = New ADODB.Connection

?

Regards,

Patrick
0
 
DanT4SyncroAuthor 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
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
DanT4SyncroAuthor 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?
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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 ...
0
 
DanT4SyncroAuthor 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
0
 
DanT4SyncroAuthor Commented:
Many thanks for you reply again. I shall do as you suggest and let you know what the score is.

Regards,

Dan
0
 
jjafferrCommented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.