Hi Mota,
the code here is using the 'Microsoft ADO Ext. 2.8 for DDL and
Security' library (ADO)
how to to use
Call RelinkTable('MyTable','MyTable','c:\mymdb')
Function RelinkTable(strTable As String, strSourceTable As String,
strSourceDB As String) As Boolean
On Error GoTo Err_RelinkTable
Dim adocat As New ADOX.Catalog
Dim adotbl As New ADOX.TABLE
Set adocat = New ADOX.Catalog
Set adocat.ActiveConnection = CurrentProject.Connection
Set adotbl.ParentCatalog = adocat
On Error Resume Next
adocat.Tables.Delete strTable
On Error GoTo Err_RelinkTable
adotbl.NAME = strTable
adotbl.Properties("Jet OLEDB:Link Datasource") = strSourceDB
adotbl.Properties("Jet OLEDB:Link Provider String") = "MS Access"
adotbl.Properties("Jet OLEDB:Remote Table Name") = strTable
adotbl.Properties("Jet OLEDB:Create Link") = True
adocat.Tables.Append adotbl
Exit_RelinkTable:
Exit Function
Err_RelinkTable:
If Err.Number = -2147217860 Then
Exit Function
Else
Resume Next
End If
End Function
Hope it helps, if you want I will try and find the DAO version of the
code for you.
Regards
Alex