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.
Not to sound ignorant, but the front end being the DB they are working out of, and the back end is the one with the log in's or the secured db?
I only have one DB that they are using and it is a flat file DB. I am I on the right track?
Normally, when creating a database on a standalone system your database MDB/MDE files have all the objects in it like your, tables, queries, forms etc...
When you create a database that is going to be used on more than one system through a LAN. The Database file is split into two (2) files. A BackEnd (BE), which contains only your data (Tables). The Frontend (FE) contains all the Queries, Forms, Reports, Macros and Modules. The Tables in the FE are linked from the BE. (You may also have a few local tables to contain temp data for the Current user.)
You only have one(1) BE file with numerous FEs. The FE DB is the one that is supplied to your user.
What this does is can create different FE, each using the same BE. For example one FE, is the admin allowing access to all the Data while another FE allows only access to Employees info and another only to Shipping etc...
Also since all you data in located in one file, this makes it easier to maintain and for you user, the FE is useless without access to the BE.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.