We help IT Professionals succeed at work.
Get Started

ADO Connection Failed Method 'Open' of Object 'Connection' failed

petef
petef asked
on
1,399 Views
Last Modified: 2013-12-25
Wayn on April 30 posed a similar question.  He apparently discovered the answer himself, stating that MDAC 8 sucks.  Since I don't believe I installed MDAC 8 on my system, his anwer left much to be explained.

Simply put I have one machine out of three XP machines that produces the error above I would really like to solve the problem.  The same machine which is now failing handled everything properly a week ago.  The original code is too large to show here, so I simply created a sample from a microsoft example and it fails the same way. The code runs a copy of the OpenMyDB subroutine shown in a microsoft explanation of ADO as follows:

Sub OpenMyDB()

Dim cnnNorthwind As New Connection
Dim rsCustomers As Recordset

'Create the connection.
    cnnNorthwind.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=C:\Program Files\Microsoft Office\Office\" & _
        "Samples\Northwind.mdb;"

'Create recordset reference and set its properties.
    Set rsCustomers = New ADODB.Recordset
    rsCustomers.CursorType = adOpenKeyset
    rsCustomers.LockType = adLockOptimistic

'Open recordset and print a test record.
    rsCustomers.Open "Customers", cnnNorthwind, , , adCmdTable
    Debug.Print rsCustomers.Fields(0).Value, rsCustomers.Fields(1).Value
    rsCustomers.Close
    cnnNorthwind.Close

End Sub

The code fails with the Ado connection failed open method.  The DB exists, the path is correct, but the method fails.  My only comment at this point, is something must have changed and resulted in an incompatibility between components, dll's or something.

Any recommendations??

Thanks in advance for any assistance
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE