Effective deployment of Access application front ends to individual users is a high priority for professional developers. Microsoft Guidelines and developers' own experience makes it essential to deploy the Access front end application such that:

  • each user has their own copy of the Access front end application, and
  • users are not easily able to find or use the network copy.

  • The bat file below provides both functionality and flexibility; it should be straightforward to drop it into most business environments.

    • The script is easily adaptable by changing the constants at the top.
    • It sends a command to your application so that the application opens successfully only by using the icon, not by finding the network master version and attempting to open it directly. For this to work, you must include the following piece of VBA code in the opening sequence of your application:
    • 
              If Command <> "BBApplicationGo" Then
                  MsgBox "[Appname] must be started using the startup icon.", vbCritical, "Application Closing"
                  Application.Quit
              End If
      
    • If the master version is missing or unavailable, the error is shown in a small Windows style popup.
    • New versions of optional files such as templates, brochures, training documents etc are automatically copied to the user's local drive.

    Note that the '/D' switch in XCOPY for the application is omitted. This means that the user's local copy is always replaced, even if the operating system file timestamps suggest that the network master version is not newer than the local copy.

    This avoids the situation where a user exits the application during the release process, and doesn't receive a new version because their local copy is timestamped as newer (even though in such a case the network master may be only a few minutes older). Networks are now almost always quick enough such that the time taken for the copy can be ignored.

    
    ::@ECHO OFF
    
    ::---------------------------------------------------------
    ::
    :: Copyright 2020 Blue Bridge Pty Ltd
    :: www.BlueBridge.com.au
    ::
    :: This code may be used and distributed within your
    :: enterprise provided that this attribution remains intact.
    ::
    ::----------------------------------------------------------
    
    :: Initialise variables
    set LocalAccessFolder=C:\Users\Studio\Documents\Access 365\PoCLogin\Test
    set NetWorkFolder=C:\Users\Studio\Documents\Access 365\PoCLogin\Test Network
    set AppName=Pathfinder.accdb
    set AppTitle=Pathfinder Database
    
    :: Create the local Folder for the Application file.
    ::
    if not exist "%LocalAccessFolder%" MD "%LocalAccessFolder%"
     
    :: Create a message file and show it in a Windows style popup if the database does not exist.
    ::
    if exist "%LocalAccessFolder%\SBUPusermsg_temp.vbs" DEL /F "%LocalAccessFolder%\SBUPusermsg_temp.vbs"
     
    if not exist "%NetworkFolder%\%AppName%" (
    ECHO MsgBox "%AppTitle% does not exist or cannot be found on the network." > "%LocalAccessFolder%\SBUPusermsg_temp.vbs"
    CSCRIPT /nologo "%LocalAccessFolder%\SBUPusermsg_temp.vbs"
    DEL "%LocalAccessFolder%\SBUPusermsg_temp.vbs"
    EXIT
    )
     
    :: Copy the VBA Application file so that the user has their own copy.
    ::
    if exist "%LocalAccessFolder%\%AppName%" DEL /F "%LocalAccessFolder%\%AppName%"
    XCOPY "%NetworkFolder%\%AppName%" "%LocalAccessFolder%\" /Y
     
     
    :: Copy all Excel templates
    ::
    ::XCOPY /s "%NetworkFolder%\VMDTemplates" "%LocalAccessFolder%" /D /Y
     
     
    :: Copy all Program Documents (Brochures, Eligibility Criteria etc)
    ::
    ::XCOPY /s "%NetworkFolder%\ProgramDocuments" "%LocalAccessFolder%" /D /Y
     
    :: Start the Application file with a command parameter. This command parameter is recognised by the Application, and 
    :: if not present, the Application will immediately Quit. This prevents users from opening the network file directly.
    "%LocalAccessFolder%\%AppName%" /cmd BBApplicationGo
    
    EXIT /B
    
    

    For Your Information: Microsoft Guidelines mention (in part): "When you have more than a few users sharing the database on a LAN, it’s best to split the database, store the back-end database in a network folder, and deploy a copy of the front-end database for each user."