Here is a more step by step.
1.First in your Backend DB Create a table as follows
Table Name:
LogOutStatus
Fields Type
LogOutStatus Number
LogOutMsg Text Field Size 200
2.In your Front End DB (The one your Users are using)
Link the Table LogOutStatus to the DB
3.Create a form.
Form Name :
LogOut
Select Properties Data Tab --> RecordSource =
LogOutStatus
Create add the LogOutStatus and LogOutMsg fields to the Form. (Does not mater where, This form will be hidden)
4. Select Properties Event Tab,
set TimerInterval =
60000
On timer =
[Event Procedure]
On Open =
[Event Procedure]
5. View the LogOut Modual(Click the three dots (...) enter the following code
Option Compare Database
Option Explicit
Private Sub Form_Open(Cancel As Integer)
Call ShutdownStat
End Sub
Private Sub Form_Timer()
Call ShutdownStat
End Sub
Function ShutdownStat()
Dim Message As String
Select Case Me.LogOutStatus
Case 2
If IsLoaded("ShutDownMsg"
Then
Forms!ShutDownMsg.Requery
Else
DoCmd.OpenForm "ShutDownMsg"
End If
DoCmd.Beep
Case 3
DoCmd.Beep
If Not IsLoaded("Startup"
Then Call CloseAllForms("Logout"
Message = MsgBox("The Your Databse Name Database is temporally Off-Line for maintenance. " & Chr(13) & "Closing Database, please try again later.", vbExclamation + vbOKOnly, "Database Off-Line"
DoCmd.Quit
End Select
End Function
6. Save the Form.
7. Create a form called ShutDownMsg.
Record Source =
Logoutstatus
Create a text box, Source =
LogOutMsg
Create a command Button, Close Form (you can use the wizard for this.)
This form is used to display a message to your user(LogOutMsg text), informing them of the database status.
8. In your database, the vary first form that opens, Add the following Code.
DoCmd.OpenForm "LogOut", , , , , acHidden
This works best when it is placed in the
Form_Current(). I use a startup Form which only has a picture, the name of the databse and a close Command button.(the close boutton then opens my main form/switchboard.
Now the only thing left is to create a form that will control the LogOutStats field. this can be done from the backend, or from a another Admin Front End DB.
Since on the LogOut Form the timer interval is set to 60000. (60000 = actually 1 Min real time). So every Min the form looks at the LogOutStatus number.
When the LogOutStatus is equal to (=)
1 --> Nothing happens
2 --> This opens the Message Box Form and displays the LogOutMsg text.
(you can change this text to what you want).
3 --> This Closes the Database.
Your admin form only has to change the LogOutStatus number and when you change it to 3, after 1 min you can say that all the users are off the databse and will stay off until you cange the number again.
Hope this helps
Dalain