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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Don't you mean:

    Set cnn = New ADODB.Connection

?

Regards,

Patrick
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
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?
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

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 ...
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
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DanT4SyncroAuthor Commented:
Many thanks for you reply again. I shall do as you suggest and let you know what the score is.

Regards,

Dan
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.