[AccessD] Question: How often do you run your remote table relinking code?

Stuart McLachlan stuart at lexacorp.com.pg
Tue Feb 15 16:55:18 CST 2022


> If the (remote) host is the same, yes. Why not? There is nothing to
> change or update. Those applications don´t even have a relinker. If a
> table scheme is modified, the client is passed new versions of the
> applications, and the users´ launch scripts will update automatically
> at the next launch.

Same for me.   But I also have some applications where the user can be working from the 
shared BE or a local copy. In that case, my Startup() function called from an AutoExec 
macro looks something like this:

IF DLookup("LinkedLocal", "ltblsysfile") THEN
    IF DLookup("LocalBEDir", "ltblsysfile") <> CurrentProject.Path THEN
        MSGBOX "Currently configured to use local data file and application has been moved!", , csApptitle
        IF DIR$(CurrentProject.Path & "\" & csBEName) = "" THEN
            MSGBOX "Data file is not in the current directory! Exiting!", , csApptitle
            DoCmd.Quit
        END IF
        MSGBOX "About to relink in new location", , csApptitle
        IF ConnectBE(CurrentProject.Path) THEN
            MSGBOX "Application now linked to local data in " & CurrentProject.Path & "." & _
            vbCrLf & "Application will now close. You should re-open it", , csApptitle
            CurrentDb.Execute "UPdate ltblSysfile set LocalBEDIr = '" & CurrentProject.Path & "'"
        ELSE
            MSGBOX "Problem relinking!", , csApptitle
            DoCmd.Quit
        END IF
    ELSE
        IF NOT fso.FileExists(CurrentProject.Path & "\" & csBEName) THEN
            IF MSGBOX("Currently configured to use local data and data file is not in the current directory! Do you want to connect to the Server?", vbYesNo, csApptitle) <> vbYes THEN
                MSGBOX "Unable to access any data. Exiting!", , csApptitle
                DoCmd.Quit
            ELSE
                svr = DLookup("NetworkBEDIr", "ltblSysfile")
                IF NOT fso.FileExists(svr & "\" & csBEName) THEN
                    MSGBOX "Unable to locate " & svr & "\" & csBEName & "." & vbCrLf & _
                    "Make sure that you are connected to a network and  that the  drive  " & svr & " is mapped to the location of the SIMS data on the network." & vbCrLf & vbCrLf & "Exiting!", , csApptitle
                    DoCmd.Quit
                ELSE
                    ConnectBE svr
                    CurrentDb.Execute "update ltblSysfile set LinkedLocal = false"
                    MSGBOX "Relinked to Server.", , csApptitle
                END IF
            END IF
        END IF
    END IF
ELSE 'networked - check OK
   svr = DLookup("NetworkBEDIr", "ltblSysfile")
   IF NOT fso.FileExists(svr & "\" & csBEName) THEN
       IF NOT fso.FileExists(CurrentProject.Path & "\" & csBEName) THEN
            MSGBOX "Cannot connect to server and there is no local data file in the current directory.  Application closing", vbCritical, csApptitle
       ELSE
           IF MSGBOX("Cannot connect to server. Do you want to connect to the exisint local data file?", vbYesNo) <> vbYes THEN
              MSGBOX "No data file avaiable. Exiting", , csApptitle
           END IF
           ConnectBE CurrentProject.Path
           CurrentDb.Execute "Update ltblSysfile set LinkedLocal = true, LocalBEDir = '" & CurrentProject.Path & "'"
       END IF
   END IF
END IF


On 15 Feb 2022 at 21:44, Gustav Brock via AccessD wrote:

> Hi Bill
> 
> If the (remote) host is the same, yes. Why not? There is nothing to
> change or update. Those applications don´t even have a relinker. If a
> table scheme is modified, the client is passed new versions of the
> applications, and the users´ launch scripts will update automatically
> at the next launch.
> 
> /gustav
> 
> Fra: Bill Benson<mailto:bensonforums at gmail.com>
> Sendt: 15. februar 2022 22:24
> Til: Access Developers discussion and problem
> solving<mailto:accessd at databaseadvisors.com> Cc: Gustav
> Brock<mailto:gustav at cactus.dk> Emne: Re: [AccessD] Question: How often
> do you run your remote table relinking code?
> 
> 
> Not sure about something:
> 
> When sending a default or new FE to a new user, would you ship the FE
> with tables already linked or perform a link on first use of that FE?
> 
> On Tue, Feb 15, 2022 at 4:17 PM Gustav Brock via AccessD
> <accessd at databaseadvisors.com<mailto:accessd at databaseadvisors.com>>
> wrote: Hi Ryan
> 
> Never.
> It is only needed if the host or a table schema is changed.
> 
> /gustav
> 
> Fra: Ryan W<mailto:wrwehler at gmail.com<mailto:wrwehler at gmail.com>>
> Sendt: 15. februar 2022 20:31 Til: Access Developers discussion and
> problem
> solving<mailto:accessd at databaseadvisors.com<mailto:accessd at databaseadv
> isors.com>> Emne: [AccessD] Question: How often do you run your remote
> table relinking code?
> 
> I'd been in the habit of running the relinking code right after the
> ODBC connection was established, it usually takes 8-10 seconds to
> delete the tabledefs and recreate them.
> 
> I recently came across this old article
> https://www.microsoft.com/en-us/microsoft-365/blog/2011/04/08/power-ti
> p-improve-the-security-of-database-connections/
> 
> In this article the author states the initial connection credentials
> are cached, and as long as your connection string on linked tables and
> passthrough queries match the 3 required criteria (database, server,
> and driver) you don't need to worry about storing UID and PWDs in the
> string (which I'm using mSysConf to negate anyway).
> 
> So now I'm only running re-linking code when I add new tables/views to
> the FE during development.  This has made startup times a lot nicer.
> 
> So my question to you all is: When do you relink remote tables?
> Always? Seldom? Never?
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 




More information about the AccessD mailing list