G
GPO
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?
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
Next
Next
UnlinkBackEnd = True
ExitHandler:
Set cn = Nothing
Set cat = Nothing
Set tbl = Nothing
Set prp = Nothing
Exit Function
ErrorHandler:
UnlinkBackEnd = False
GoTo ExitHandler
End Function
but how do I reverse the process
Cheers
GPO
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
Next
Next
UnlinkBackEnd = True
ExitHandler:
Set cn = Nothing
Set cat = Nothing
Set tbl = Nothing
Set prp = Nothing
Exit Function
ErrorHandler:
UnlinkBackEnd = False
GoTo ExitHandler
End Function
but how do I reverse the process
Cheers
GPO