Solved

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

Posted on 2010-11-30
4
949 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

830 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