Kick Users

Pappy

Registered User.
Local time
Today, 11:09
Joined
Jun 12, 2003
Messages
28
If I want to make changes accross the board how would I kick out everyone using the database. I send out an email right now, but there is always someone not at their desk and has it open. All help is appreciated.
 
All your forms will need a similar type of code for this to work. I'll not give the code, just the basic idea

Have a hidden form with only one textbox on it.

On an event of the form that should be commonly called reset the textbox on the hidden to Now()
on the on_Timer event of the form that they are 'working' on, Set the timer interval to 60000 (1 minute)

Then on the On_Timer Event
If datediff("M", HiddenTextbox, Now()) > 15 then
docmd.close 'You may want to alert the user that you are actually doing this though!
else me.timerinterval = 60000
end if

the code is probably not spot on but you get the idea.
 
I do something very similar. I don't have the code to hand right now (and can't rememer it!), but check out http://www.rogersaccesslibrary.com. This is where I originally got it from.
 
Thanks guys
I created a table called tbllogout with a yes/no, and then put in the ontimer for the main page this code...

Private Sub Form_Timer()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim strSQL As String
rs.Open "tblLogout", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs.MoveFirst
If rs!Logout = True Then
Application.Quit
End If
rs.Close
Set rs = Nothing
End Sub

You can set the internal to whatever you want, then when you go into the table and choose logout to be Yes. It will run the internal time and then boot everyone, works great.
 
The only thing missing is some kind of warning to the users. I checked my code, and I use the Tag property to tell if I've issued a warning or not.

It's not essential, but from my experience users aren't too happy being kicked out without any forewarning!!:D
 
I've actually added a msgbox, and I plan on also sending a email to everyone.
 
Oops.:o My post should be in the other, but suspiciously closely related, post - the one about kicking them out if they are idle. If that were the case many people would not ever be able to log into here, the Idle-O-Meter would be buzzing :p
 

Users who are viewing this thread

Back
Top Bottom