ADO ActiveConnection failed

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

I'm getting an "ActiveConnection failed" error with the following code and I
don't know why.

Sub ListTbls()
Dim catlg As New ADOX.Catalog

catlg.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\Program Files\Microsoft Office\Office10\" _
& "Samples\Northwind.mdb;"
End Sub

I'm using Access 2002, Windows XP Home, and I believe all my ADO references
are set. The .mdb file and path are correct. I tried several variations
with a simpler file and path but I get the same error. The error message
says:

Runtime error '-2147024769 (8007007F)':
Method 'Activeconnection' of object _Catalog failed

I have no other database programs installed other than Access 2002. Any
help is appreciated. Thanks!

Jeff
 
Hi Jeff, try this

Sub ListTbls()

Dim catlg As New ADOX.Catalog
Dim Cnn as adodb.connection
set Cnn = new adodb.connection

cnn.connectionstring= "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Program Files\Microsoft Office\Office10\Samples\Northwind.mdb;"
Cnn.open

Set catlg.ActiveConnection = Cnn

End Sub
 
Nope. That gave me a similiar error:

Run-time error '-2147024769 (8007007f)':
Method 'Open' of object '_Connection' failed

Again I tried it with a simpler path and file, but I get the same error.
Online help only returns a blank screen for this when I press the help
button on the error window.

I'm stumped! :( I even tried code using Currentproject.Connection and that
didn't work either.
 
Did you added in your project Microsoft ADO Ext. 2.x For DDL and Security
reference?.
 
Back
Top