Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method 'Open' of object '_Connection' failed

Status
Not open for further replies.

johnny2bad

Programmer
Nov 6, 2001
18
US
I just rebuilt my OS and reintalled all of my programs.

A VB project that I have been working on for sometime now (on the old build) is now giving me the error:

Run-time error '-2147220999(800401f9)':

Method 'Open' of object '_Connection' failed


I've looked up the error on the MS Knowledgebase and found that this error message translates to "Error in dll" ???

I've reintalled my MDAC (2.6 & 2.7) and this does not correct the issue.

Any Ideas?

John
 
Post some relevant code & highlight the line causing the error.
 
Sorry about that. I meant to do so...

'General Module------------------------------

'AS400 Connection Junk
Public AS400Conn As New ADODB.Connection
Public rs720 As New ADODB.Recordset
Public cmd720 As New ADODB.Command

'SQL Connection Stuff
Public conServer As New ADODB.Connection
Public rstemp As New ADODB.Recordset
Public rsSQL As New ADODB.Recordset
Public cmdSQL As New ADODB.Command

'Form----------------------------------------
'Form Load
'It fails on this line...
conServer.Open "Provider=SQLOLEDB;Data Source=IP Address;", "UserName", "Password"

'Or if that one is remmed out, it fails here. same error....
AS400Conn.Open "Provider=IBMDA400;Data Source=System Name;", "UserName", "Password"





 
The code looks OK, sounds like your DLLs are not correctly registered.

When you declare a connection As New it is not actually created until you first reference it in your code. The call to the Open method is the first reference, so this is the point at which the object creation fails. To confirm, declare it without the New keyword and put the following line before you Open it.
Code:
Set conServer = New ADODB.Connection
The code should then fail on that line.

Try reinstalling MDAC.
Also look at Thread792-99494 and Thread222-14542
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top