Access/VBA Library

Close applications remotely

Sometimes you need to perform maintenance task on a database and therefor all users should close there applications. Though Access has no standard functionality close all applications remotely, it can be done very easily.

The concept is very easy:

  • Let the application look for a particular file somewhere on the network;
  • When the file exists, let the user know that the application needs to be shut down;
  • Allow the users some time to finish their work;
  • Shut down the application.

 I created a demo application to show how this works and how I use this mechanism in my projects.

 Click for download

To implement this solution in your project, just import the forms "Shutdown" and  "ShutdownWarning" and put the following code somewhere in your startup function:

DoCmd.OpenForm "ShutDown", WindowMode:=acHidden

Make sure the constant cShutDownFile contains the full path to a file all users can access.

 

The hidden form ShutDown checks every minute if the file cShutDownFile exists. If it exists the form ShutdownWarning will popup at the right at the bottom of the screen. The user can click OK to finish his work or click Shutdown to close the application right away.

Shutdown Warning

In this way you are sure you will have full access to the database within 6 minutes!

When you are done, do not forget to delete the cShutDownFile, because users can not access the application while this file exists on the system.