Linked tables using ADO



I posted this here a few days ago. Given that there has been no response can
I assume that there is no way to link tables using ADO?
Is it possible to create a linked table in Access 2000
using ADO? I'm not keen on using docmd.transferdatabase in
case I need to use the code in something other than Access.

FWIW The table being linked to is also an MS Access table.

I can unlink them with:

Function UnlinkBackEnd(strDBToCompact As String) As Boolean
Dim cn As ADODB.Connection
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim prp As ADOX.Property

On Error GoTo ErrorHandler

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

cat.ActiveConnection = cn
For Each tbl In cat.Tables
For Each prp In tbl.Properties
If (prp.Name = "Jet OLEDB:Link Datasource") And _
(prp.Value = strDBToCompact) Then
Progress " Unlinking " & tbl.Name
cat.Tables.Delete tbl.Name
End If
UnlinkBackEnd = True
Set cn = Nothing
Set cat = Nothing
Set tbl = Nothing
Set prp = Nothing
Exit Function
UnlinkBackEnd = False
GoTo ExitHandler
End Function

but how do I reverse the process



Ken Snell [MVP]

Here's a few links (probably wrapped by the newsreader) to posts in other
newsgroups on similar question:

You probably can find many other posts that may have the info you seek via
Google Groups

I haven't used ADO for this purpose so I cannot provide a direct answer -


I code using ADO (with Access 2000), but when I need to
link Access tables I use the following DoCmd
DoCmd.TransferDatabase acLink, "\\svr002
acTable, "NameTableToLink", "LinkedTableName", False

then to delete the table - I simple do a
DoCmd.DeleteObject acTable, "TableName"

**Use quotes.

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