bill201
asked on
Changing linked table location (that protected with a password) programatically on acccess 2013
hi
how can i with vba relink a table to database that closed with password. for example i have this code
how can i with vba relink a table to database that closed with password. for example i have this code
For Each td In TDS
If td.Connect = ";DATABASE=" & OldPathName Then
td.Connect = ";DATABASE=" & NewPathName, passowrd:mypassword'
td.RefreshLink 'Refresh the link
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Public Function FixTableLink()
Dim db As Database
Dim strPath As String
Dim strConnect As String
strPath = "NewPathName"
strConnect = ";DATABASE=" & strPath & "; password:mypassword"
Set db = CurrentDb
For Each tbl In db.TableDefs
If Nz(DLookup("Type", "MSysObjects", "Name = '" & tbl.name & "'"), 0) = 6 And tbl.Connect <> strConnect Then
tbl.Connect = strConnect
tbl.RefreshLink
End If
Next tbl
End Function