[AccessD] A2003: Putting both Front and Back ends on a removabledrive

Joe O'Connell joeo at appoli.com
Sun Dec 16 22:38:53 CST 2007


Darren,

Here is a function that will Relink all tables in a BE that resides in
the same directory as the FE.  Call it as the first thing when the FE
loads.

Joe O'Connell

'-----------------------------------------------------------------
'                                                 Sub RefreshLinks
'   Refresh all links to use Access BE database
'   in the same directory as the calling program
'   strFile = name of backend mdb (no path)
'-----------------------------------------------------------------
Public Function RefreshLinks(ByVal strFile As String) As Boolean
    On Error GoTo RefreshLinks_Err
    Const strAccessPrefix = ";DATABASE="
    Dim strLinkName As String
    Dim tdf As TableDef
    strLinkName = Left$(CurrentDb.name, InStrRev(CurrentDb.name, "\")) &
strFile
    For Each tdf In CurrentDb.TableDefs
        If Len(tdf.Connect) > 0 Then
            If Left$(tdf.Connect, Len(strAccessPrefix)) =
strAccessPrefix Then
                If InStrRev(tdf.Connect, strFile) > 0 Then
                    tdf.Connect = strAccessPrefix & strLinkName
                    tdf.RefreshLink
                End If
            End If
        End If
    Next tdf
    RefreshLinks = True
RefreshLinks_Exit:
    Exit Function
RefreshLinks_Err:
    MsgBox "Unexpected error while refreshing links" & vbCrLf &
Err.Description, vbInformation + vbOKOnly, "Relink error"
    RefreshLinks = False
    Resume RefreshLinks_Exit
End Function



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren D
Sent: Sunday, December 16, 2007 7:32 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] A2003: Putting both Front and Back ends on a
removabledrive

Hi Team

 

I have a client who has one of those portable laptop drives in a USB
case - Cool

 

He wants both the front and back ends of his APP to reside on this drive
but
wants the Front 

end and Back end to still remain separate - for ease of use of data
backup -
Cool also

 

This means getting the front end to 'talk' to the back end without using
drive
letters etc

 

In the old DOS days you could use a syntax (I have forgotten it) to
simply refer
to 'things'

on the current drive and even current folder

 

Does anyone know how I would go about linking the FE and BE on the same
drives

(In this case a removable one) thus without using drive letters etc?

 

Many thanks in advance

 

DD

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list