Solved

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

Posted on 2010-11-30
4
939 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I spend 4 hours for this. thank you so much
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

772 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

11 Experts available now in Live!

Get 1:1 Help Now