Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clear the database of users question

Status
Not open for further replies.

julius1

Technical User
Oct 31, 2002
142
US
Is there a macro or something that can be created to log out all users when updates need to be made, instead of chasing them down individually?
 
I am sure I have seen something on Tek-Tips, have youtried searching the forum?

Sorry can't be more help



Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
 
Hi, julius1
Take a look at Thread705-79802

Regards

Dalain
 
I did take a look at that already, but I have no clue as to how to set it up. I don't know if I can figure this one out or not.
 
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
 
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?
 
Hi, julius1

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.

Regards

Dalain



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top