UNC question

  • Thread starter Thread starter golfinray
  • Start date Start date
G

golfinray

Is there a way to programatically change the unc path to all linked tables at
once?
 
Only by using VBA to loop through the TableDefs collection and changing each
one that needs to be changed.
 
Is there a way to programatically change the unc path to all linked tables at
once?

You can use our free J Street Access Relinker. Just browse using
\\server instead of a drive letter to get the UNC patch.

http://www.jstreettech.com/downloads

It handles multiple Access back-end databases, ignores ODBC linked
tables, and can automatically and silently relink to back-end
databases in the same folder as the application (handy for work
databases or single-user scenarios). There's a ReadMe table with
instructions.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
Here is part of what I use, and it may get you close. My full code also
includes a browse button so the user can browse to the new back end, but here
is the germane portion. If it does not work because I have missed a variable
declaration or something, I may have to just send you the whole form that I
use

Private Sub ButtonReLink_Click()
Dim FilePathData as String
FilePathData = "\\MyServer\MyShare\MyDBFolder\MyDB.mdb" 'path to back end

'open DB connection before re-link to make it faster
Dim dbData As DAO.Database
Set dbData = OpenDatabase(FilePathData)
're-link
Set dbProgram = CurrentDb
txtStatus = SysCmd(acSysCmdInitMeter, "Refreshing Links...",
dbProgram.TableDefs.Count)
For TableCount = 0 To dbProgram.TableDefs.Count - 1
If dbProgram.TableDefs(TableCount).Connect <> "" Then
dbProgram.TableDefs(TableCount).Connect = ";DATABASE=" &
FilePathData & ""
dbProgram.TableDefs(TableCount).RefreshLink
txtStatus = SysCmd(acSysCmdUpdateMeter, TableCount)
End If
Next TableCount
StatusReset
'close DB connection
dbData.Close
Set dbData = Nothing
End Sub
 
Back
Top