?
Solved

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

Posted on 2006-03-28
9
Medium Priority
?
229 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
0
Comment
Question by:DanT4Syncro
8 Comments
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 16311256
Hi DanT4Syncro,
> Set cnn = New ADOR.Connection

Don't you mean:

    Set cnn = New ADODB.Connection

?

Regards,

Patrick
0
 

Author Comment

by:DanT4Syncro
ID: 16314034
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
 

Author Comment

by:DanT4Syncro
ID: 16314335
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 85
ID: 16315878
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
 

Author Comment

by:DanT4Syncro
ID: 16325079
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
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 16328882
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
 

Author Comment

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

Regards,

Dan
0
 
LVL 27

Expert Comment

by:jjafferr
ID: 16855582
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question