Linking to secure DB

J

Jake

I am trying to use the following code to link to a table
in a secured database:

Sub CreateLinkedJetTable()
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim cn As ADODB.Connection

Set cn = New ADODB.Connection

Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection

Set tbl = New ADOX.Table

' Create the new table.
tbl.Name = "Linked_TestTable"
Set tbl.ParentCatalog = cat

' Set the properties to create the link (items refer to
OTHER db).
tbl.Properties("Jet OLEDB:Link Datasource") = "C:\MyDB.mdb"
tbl.Properties("Jet OLEDB:Remote Table Name") = "tblTest"
tbl.Properties("Jet OLEDB:Create Link") = True
tbl.Properties("Jet OLEDB:Link Provider String")
= "Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyDB.mdb;Jet
OLEDB:System Database=C:\System.mdw"

'Append authentication parameters to the end of the
existing connection string
tbl.Properties("Jet OLEDB:Link Provider String") = _
tbl.Properties("Jet OLEDB:Link Provider String")
& ";UID=Jake;PWD=MyPass;"

'Open connection to DB where table resides
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;User
ID=Jake;Password=MyPass;Data Source=C:\MyDB.mdb;Jet
OLEDB:System Database=C:\System.mdw"

' Append the table to the tables collection.
cat.Tables.Append tbl
Set tbl = Nothing
Set cat = Nothing

End Sub
---------------------End Code----------------------

On the third to last line (cat.Tables.Append tbl) I
receive run-time error -2147467259 (80004005) Could not
find installable ISAM. I can't seem to find any situation
in the Knowledge Base that fits.

Any suggestions?

Thanks!
Jake
 

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