Solved

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

Posted on 2010-11-30
4
952 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

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!

Question has a verified solution.

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

Suggested Solutions

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…

739 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