Dim adoCn As ADODB.Connection
Dim adoCat As New ADOX.Catalog
Dim adoTbl As New ADOX.Table
Private Sub Command1_Click()
'Create Link...
Set adoCat = New ADOX.Catalog
Set adoCat.ActiveConnection = adoCn
Set adoTbl.ParentCatalog = adoCat
adoTbl.Name = "LinkTable"
adoTbl.Properties("Jet OLEDB:Link Datasource") = App.Path & "\myLinkDatabase.mdb"
adoTbl.Properties("Jet OLEDB:Link Provider String") = "MS Access;Pwd=myLinkPassword"
adoTbl.Properties("Jet OLEDB:Remote Table Name") = "LinkDatabaseTable"
adoTbl.Properties("Jet OLEDB:Create Link") = True
'Append the table to the tables collection
adoCat.Tables.Append adoTbl
Form1.Caption = "Link Created..."
End Sub
Private Sub Command2_Click()
'Refresh Link...
Set adoCat = New ADOX.Catalog
Set adoCat.ActiveConnection = adoCn
Set adoTbl.ParentCatalog = adoCat
For Each adoTbl In adoCat.Tables
If adoTbl.Type = "LINK" And (adoTbl.Name = "LinkTable") Then
adoTbl.Properties("Jet OLEDB:Link Provider String") = "MS Access;Pwd=myLinkPassword"
adoTbl.Properties("Jet OLEDB:Link Datasource") = App.Path & "\myLinkDatabase.mdb"
End If
Next
Form1.Caption = "Link Refreshed..."
End Sub
Private Sub Form_Load()
strCn = App.Path & "\myDatabase.mdb"
Set adoCn = New ADODB.Connection
With adoCn
.Provider = "Microsoft.JET.OLEDB.4.0;" & _
"Jet OLEDB

atabase Password=myPassword"
.Open strCn
End With
End Sub