[AccessD] BE Relinker

Stuart McLachlan stuart at lexacorp.com.pg
Tue Jan 17 15:43:55 CST 2006


On 17 Jan 2006 at 8:09, Joe Hecht wrote:

> Did some kind, generous and way smarter then me soul create
> at BE relinker?
> 

Here's my standard module that I use when the BE and FE are in the same 
directory.  Not that it if your BE is password protected, you will need to 
modify this slightly since "tdfloop.Connect" will contain additional info 
before the first semicolon. 


Function RelinkTables() As Long
Dim tdfloop As TableDef
With CurrentDb
        For Each tdfloop In .TableDefs
            If Left$(tdfloop.Connect, 10) = ";DATABASE=" Then
               tdfloop.Connect = ";DATABASE=" & ApplDir & 
FileBasename(Mid$(tdfloop.Connect, 11))
               tdfloop.RefreshLink
            End If
        Next tdfloop
End With
End Function

Static Function ApplDir() As String
   Dim strApplDir As String
   Dim strTemp As String
   If strApplDir = "" Then
    strTemp = DBEngine(0)(0).Name
    strApplDir = Left$(strTemp, InStrRev(strTemp, "\"))
   End If
   ApplDir = strApplDir
End Function

Function FileBasename(fullpath As String) As String
    FileBasename = Right$(fullpath, Len(fullpath) - InStrRev(fullpath, 
"\"))
End Function-- 
Stuart





More information about the AccessD mailing list