?
Solved

MS VBA AODBC Run-time Error

Posted on 2007-03-26
4
Medium Priority
?
370 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 2000 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

Industry Leaders: 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

In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Suggested Courses

719 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