Article ID: 304408 - Last Review: March 29, 2007 - Revision: 7.1 How to shut down a custom Access application remotelyThis article was previously published under Q304408 Advanced: Requires expert coding, interoperability, and multiuser
skills. This article applies only to a Microsoft Access database (.mdb or .accdb). On This PageSUMMARY Sometimes, you may have to perform maintenance tasks on a
Microsoft Access database, such as compacting or repairing, making backup
copies, or making design modifications. Many of these operations require that
all users exit the database. However, there is no built in way to force users
to quit Microsoft Access. And it is not a good idea to just disconnect the user
from Network solutions. That can cause the database to become
corrupted. This article shows you one approach that you can use to gracefully shut down a front-end Access database application. You can also use many of these concepts to compact or repair the database, make backup copies, and so on. Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. MORE INFORMATIONHow the Solution WorksThe solution works as follow. On a server, there is a file in a folder. This file can be named anything. For this solution, a file named chkfile.ozx is used. When this file is renamed or deleted, it notifies the front-end Access application that it has to close.A form is built that opens when users start the front-end database application. This form checks for the existence of the file on the server at a set interval. It uses the TimerInterval property and the OnTimer event to do this. If the file is found, nothing happens. If the file is not found, the form will display another form to warn the user that the database will be automatically closed in a specified amount of time. NOTE: This solution does not use the MsgBox function to warn the user. The MsgBox function will wait for user input before it runs any code. This would defeat the purpose of the solution. To gracefully close client sessions, this solution renames the file that is being checked. When everything that has to be accomplished is finished, this solution renames the file back to the original name. This lets the users know that they can start the front-end database again. This process can also be automated to provide unattended operation by using a scheduled service on the server that renames chkfile.ozx at specified times. Steps to Create a Sample ScenarioTo demonstrate how this solution works, you will have to have the following:
Timing of Solution EventsNOTE: All of the following times are approximate, and they start after the renaming of chkfile.ozx.
REFERENCES For related information, please see the following articles
in the Microsoft Knowledge Base:
287655
(http://support.microsoft.com/kb/287655/EN-US/
)
ACC2002: How to Use Connection Control to Prevent Users from Logging On at Run Time
230575
(http://support.microsoft.com/kb/230575/EN-US/
)
ACC2000: How to Start Access by Using the Windows NT Schedule Service
303528
(http://support.microsoft.com/kb/303528/EN-US/
)
ACC2002: How to Minimize Database Corruption When Using Microsoft Jet 4.0
| Article Translations
|
Back to the top
