Solved

MS VBA AODBC Run-time Error

Posted on 2007-03-26
4
355 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
  • 2
4 Comments
 
LVL 23

Accepted Solution

by:
Christopher Kile earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
yvw :)
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 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

9 Experts available now in Live!

Get 1:1 Help Now