Shutdown databases or send messages to users
The Administration button allows you to send messages to users of a database and to shutdown the database.
Figure 1 - The Administer button on the Main Form
Once you click on the Administration button (Figure 1), you are presented with a form (Figure 2) that allows you to either send a message to users or to shutdown a database. You will now see how to do that.
<<< Click to enlarge
Figure 2 - The administration form just after a message was posted to users
Sending Messages To Users
To send a message to users of a database, all you need to do after selecting the correct database is
Type the message that you want your users to see into the "Message for users of the database" box (as shown in Figure 3)
Press the Post Message File button
Figure 3 - Using the Workbench to send users a message
When you press the Post Message File button, an information box will appear (Figure 4) that explains that a text file has been created. As you can see, this file has exactly the same filename and it is located in the same folder as your database. The existence of this Workbench file (file type of .awbmsg) tells your database to display the message in the file.
Figure 4 - Information about the workbench message file that was created
Generally it is a good idea now to return to the main Workbench form and open the database and wait for the message to appear.
NOTE: It is best to leave the Administration form open in the background so that you can delete the message when you no longer want it to appear. If you now look at the bottom of the Administration form, you will find that a highlighter shows that the message file is open.
Figure 5 - Highlighter on the Admin screen to show that a message file is open.
Testing For And Displaying a Workbench Message File
To make the user messages form pop up on every users computer, you need to add a form to the Access database. We will call this form the Database Messages form and you need to ensure that the form remains open (but hidden) whenever the database is open (Autoexec macro). Included in that form is some code (VBA) that is designed to look every few minutes or so for the existence of the Workbench message file. When it does find the file, it reads the message and displays it on the Database Messages form which it will now Pop Up in front of all the other Access windows. Once the user reads the message (as shown in Figure 6), they will probably click the OK button to hide the form again. If you leave the VBA that we provide AS IS, the form will pop up again next time the form timer event is run again. We recommend an interval of 5 minutes between checking for the existence of the Workbench message file.
Figure 6 - And example of what a user message window will look like in your database
Getting The Code To Display A Workbench Message File
To make the messaging happen in your Access database, you need add the following VBA to the Timer event of your Database Messages form
These two small subroutines will undertake these checks for you and display the message from the files. To find the VBA code for these subroutines, you can click on the GetCode button at the bottom of the Admin screen (see Figures 1 and 7). You will then be given detailed instructions on how to setup your form.
Figure 7 - The button that will copy your message code to the clipboard
The easier way to achieve the same result is to purchase the Access Workbench and copy the sample Database messages form into your own database. You will receive this form and a number of other useful administration forms in the registration email that you receive from us.
Shutting Down The Database
To shutdown a database, all you need to do after selecting the correct database is
Type the message that you want your users to see after the database is shutdown into the "Message to display when the database is shutdown" box (as shown in Figure 8)
Press the Post Shutdown File button
Figure 8 - Using the Workbench to Shutdown a database
What Happens When The Shutdown Process Starts
The behavior and setup of the Workbench shutdown works in almost the same way as the messaging system in that it looks for the existence of a Workbench file (file type of .awbsdf) before the appropriate action is taken. When the file is found, the database is closed down and the shutdown message is presented to the user in a Word document (Figure 9) so that they understand why the database is no longer open. The method used to shutdown the database closes all the open forms and reports and saves the information (if it can).
Figure 9 - The database shutdown message is displayed in a Word file
De-Activating The Shutdown File
Once you post a file, all the users will generally have their database closed down within a few minutes. As this technique relies on the existence of the file to monitor for shutdowns, it is important that you return as soon as you have finished your vital administration tasks and remove the shutdown file using the Remove Shutdown File button (shown in Figure 8). In the meantime, a highlighter (Figure 10) shows you that the shutdown file is still in play.
Figure 10 - Highlighter shows that a shutdown file still is affecting your users
Further Reading and Code
If you have a setup where users are using databases on local drives or have multiple front-ends connecting to the same back-end, you will need to read this page.
Other Access Workbench Topics