Solved

MS VBA AODBC Run-time Error

Posted on 2007-03-26
4
365 Views
Last Modified: 2013-12-25
I'm trying to use the Microsoft ActiveX Data Objects 2.8 Library to establish a connection to a Sybase database.  I have successfully used the XLODBC.XLA driver on the same computer, so I believe the ODBC connection is set up properly.  This is using Excel 2000 and Windows 2000 Professional.

I am getting the following error when I try to set the connection:
     Run-time error '-2147024769 (8007007f)':
     Automation error
     The specified procedure could not be found.

However, the library is selected in the VBA References list.  Here is my code; the error is generated on line 13 (commented accordingly):

     Sub testSQL()

     Dim uidA, pwdA As String
     dsnA = InputBox("Data Server Name:")
     uidA = InputBox("DB User ID:")
     pwdA = InputBox("DB Password:")
     
     Dim conn As ADODB.Connection
     Dim connStr As String
     Dim rs As ADODB.Recordset
     
     connStr = "DSN="& dsnA & ";UID=" & uidA & ";PWD=" & pwdA & ";"
     Set conn = New ADODB.Connection     '<---- This is the line that generates the error message
     conn.Open connStr
     conn.Close
     Set conn = Nothing

     End Sub

Does anyone know what might be causing this error?  Thanks in advance for the help.
0
Comment
Question by:davidjt61983
[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
4 Comments
 
LVL 23

Accepted Solution

by:
Christopher Kile earned 500 total points
ID: 18795105
After consulting several references and finding a mishmash of ideas for solving this, I'm reduced to two suggestions:  either reinstall MDAC 2.8, or attempt to identify and re-register each and every DLL it uses.  I recommend this because it seems that while the system can find the object (otherwise you would have gotten an object not found error), the interface definitions have become corrupted somehow, so that it can't find the constructor method.

As an alternative, you can try CreateObject("ADODB.Connection") and see if it instantiates properly.
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 18810075
In Excel go to your code window then Tools/References.  Is the following one of the checked items?

Microsoft ActiveX Data Objects 2.8 Library?

If it is, try unchecking, close the dialog box, then go back and check it again.  If that does not work try library 2.7

Leon
0
 

Author Comment

by:davidjt61983
ID: 18815739
Thanks for your help.

It took a day to get the package re-installed due to office policies, etc.  I am now able to establish a connection.
0
 
LVL 23

Expert Comment

by:Christopher Kile
ID: 18816351
yvw :)
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

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…
Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

751 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