Search code examples
windowsms-accessnetwork-drive

How to ensure network drives are connected for an application?


I have a desktop Windows application that is installed in small office environments.

The application uses an .MDB database file as its database which is stored on a network drive.

Configuration files specify the path of the .MDB file on the server using a letter drive: eg. f:\data\db.mdb

The application needs to access this database file when it starts. How can I ensure the network drive is connected and accessible when the application starts?

Sometimes Windows doesn't reconnect network drives and the only way to connect them is to double-click on them in My Computer, even when "Reconnect at logon" is ticked when mapping the drive.

Would a solution be to use \\machine_name\share instead of drive letters?


Solution

  • You asked, "Would a solution be to use \machine_name\share instead of drive letters?"

    I think, yes, it could be. A UNC path avoids 2 problems:

    1. share not connected to a drive letter
    2. share is connected, but mapped to a different drive letter than you expect

    The unknown is whether anything in your application makes a UNC path for the MDB either a complication or a flat out deal-breaker.