UNC Alias for a Local Folder

The subst command lets us mimic mapped network drives. But what if your backend tables are linked using UNC paths? Don't worry. We can handle those, too!

UNC Alias for a Local Folder

You should never develop using production data.

The Simple Case: Drive Letter Mapping

Most of our clients that use file-based back-end databases use drive letters to map to the network drives where those files are stored, such as P:\Data\MyDb.accdb.

With that approach, it is easy for us to host development copies of the database files on our local machines, for example D:\MyClient\Data\MyDb.accdb.  Then, when working on that application, we can use the subst command to mimic the client's environment while pointing to our development data:

subst P: D:\MyClient

The Trickier Case: UNC Paths

One of our clients prefers to use UNC paths to connect to back-end Access databases on their network.  Those are the paths that start with double backslashes, such as \\MyServer\MyShare\Data\MyDb.accdb.

Creating local aliases that mimic UNC paths on your local computer is much trickier.  

Modifying the Local Hosts File: A Failed Approach

My first attempt was to edit my local hosts file and point "MyServer" at the loopback IP address, 127.0.0.1.  

I thought that I could then share a folder from my local device and connect to it using the standard net use command.  Alas, this did not work.  I was never able to get past the authentication step.  No matter what accounts I tried, it always said I had entered a bad user name or password.

I do think editing the hosts file might have worked if the development data was on a different Windows machine.  

Modifying the Registry: A Viable Approach

After exhausting all the user name-password combinations I could think of, I abandoned the idea of using the local hosts file.

Instead, I asked the internet for help.  The internet delivered.

In an article titled, Creating a NetBIOS alias for the local machine, Michael Levy provided the keys to the UNC alias kingdom.  To make it work, you have to create four new registry entries.  

The first two entries are needed to allow the feature to work:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters

Add a new DWORD value called DisableStrictNameChecking.
Set its value to 1.


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters

Add a new DWORD value called DisableLoopBackCheck
Set its value to 1.

The next two entries contain the actual aliases for your machine name.  Continuing with the examples from above, we would add one value to each of these Multi-String Values: MyServer.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters

Add a new Multi-String value called OptionalNames.
Enter one or more aliases, one per line.


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0

Add a new Multi-String Value BackConnectionHostNames.
Enter one or more aliases, one per line.

Forcing the registry changes to take effect

To enable the changes, you'll need to restart the Server service.  

From an admin command prompt, execute the following commands:

net stop server
net start server

If that does not work for whatever reason, try a full system restart.

Share your local drives

To finish the process, you will need to create a share on your local computer with the same name as the client's share.  

NOTE: The Share Name does not need to be the same as the Folder Name.  

For example, I can share the \MyClient\ folder on my computer as \MyShare\ so that it matches the client's environment:

  • Right click on the \MyClient\ folder
  • Choose Properties
  • Go to the Sharing tab
  • Click on [Advanced Sharing]
  • Check the box to [√] Share this folder
  • Set the Share name to MyShare
  • Click [OK]

Test it out

  • Open File Explorer
  • Navigate to \\MyServer\MyShare

You should see the contents of your D:\MyClient\ folder.

You can now put your development data files in this folder.  This allows you to see them from your front-end Access file without having to relink the tables when moving between development and production.

BUG ALERT [Updated 2022-01-18]

Microsoft broke this feature with a recent security update.  Read my bug alert article for details:

Bug Alert: Can’t Access Shared Folders via UNC Alias
UNC aliases are a great way to set up development environments for Access applications that rely on UNC paths. It’s too bad Microsoft broke them.

External articles

Creating a NetBIOS alias for the local machine
My current assignment is with a client that has a system consisting of multiple components where each component is a separate .EXE. This wou...

All original code samples by Mike Wolfe are licensed under CC BY 4.0