Solved

Microsoft Dao 3.6 Object Library ,Microsoft ActiveX Data Object 2.8 Library Reference Issues

Posted on 2010-11-30
4
943 Views
Last Modified: 2012-05-10
In my Visual Basic Project, I have added the references,

1.      Microsoft Dao 3.6 Object Library
2.      Microsoft ActiveX Data Object 2.8 Library – newly added reference and the below piece of code:

I am using MS Office 2000

    Const DataProvider As String = "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;"
   
    Dim adoPrimaryRS As Recordset
    Dim db      As ADODB.Connection

    'Execute the query.
     Set adoPrimaryRS = New ADODB.Recordset
    src = sql()
    ADODB.adoPrimaryRS.Open src, db, adOpenDynamic, adLockOptimistic


Error - adoPrimaryRS - Method or Data memebr not found.

If I change the order of the reference, then the above code is working. but the existing code is not working.

It seems both  above reference have conflict.
0
Comment
Question by:bobbey
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 34240760
Hi

You are getting the Error - adoPrimaryRS - Method or Data memebr not found, beacuse you are adding ADODB to your adoPromaryRS object in this line

  ADODB.adoPrimaryRS.Open src, db, adOpenDynamic, adLockOptimistic

You should use it like this

adoPrimaryRS.Open src, db, adOpenDynamic, adLockOptimistic
0
 

Author Comment

by:bobbey
ID: 34240943
now the error become,
.Open method  or data memebr not found.

I couldn't find the method Open after putting the ".".

if I change  reference order like

1.  Microsoft ActiveX Data Object 2.8 Library
2. Microsoft Dao 3.6 Object Library

adoPrimaryRS.Open src, db, adOpenDynamic, adLockOptimistic

the above  code works
0
 
LVL 13

Accepted Solution

by:
gamarrojgq earned 500 total points
ID: 34241000
Ok, you do not need to change the reference order, just add ADODB  to your object declaration like this

Dim adoPrimaryRS As ADODB.Recordset

This happend because DAO and ADO both have a Recordset type object, so you have to specify wich one you are trying to use.
0
 

Author Closing Comment

by:bobbey
ID: 34241024
I spend 4 hours for this. thank you so much
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now