ADO ActiveConnection failed

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
 
V

Victor Koch

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
 
J

Jeff

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.
 
V

Victor Koch

Did you added in your project Microsoft ADO Ext. 2.x For DDL and Security
reference?.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top