View Full Version : kicking people out


Darth Vodka
04-14-2008, 03:38 AM
hi

i have a flag in the back end of my database, which once ticked by me, should chuck them out of their front ends

it runs off the timer of the opening form and looks like thisL


Sub EveryoneGetOut()
Const MINUTESLEFT As Integer = 10

If booQuitFlagTicked Then
If Now() > dtQuitTime Then
AuditTrack "kicked someone out", "main form timer"
Application.Quit
Else
If (dtQuitTime - Now()) * 24 * 60 < MINUTESLEFT Then
'MsgBox "database to close in next " & 1 + Int((dtQuitTime - Now()) * 24 * 60) & " minutes for repairs/upgrades"
UpdateStatus "database to close in next " & Int((dtQuitTime - Now()) * 24 * 60) & " minutes for repairs/upgrades"
End If
End If
Else
'Debug.Print "no kicking done " & Now()
End If

End Sub


two things are going wrong:-

1) i have one user that it keeps trying to kick out (i see it keep loggin it in the audit tracker) but he never gets kicked out
2) i have another user that doesn't even get a mention as trying to kick out, but they're in it. IT told me so from looking at the network locks (and my audit trail knows they logged in earlier)

i'm a bit puzzled, how can the application.quit line run without making someone quit?

and as for the other user that it doesn't even try to kick out, i'm really really puzzled!

:confused::confused::confused:

and ideas welcome

LynnEsther
04-14-2008, 03:54 AM
I tried to implement something hauntingly similar, and had hauntingly similar problems. Here is what I learned: if a person is logged into the database and then walks away, say to attend a several hour long meeting, their computer goes into "sleep" mode. If I happen "tick" the checkbox to kick users out, the person who has walked away doesn't get kicked out. I think the issue is that the timer (which I had on the Main Switchboard -- a form that the user cannot close unless they log out) gets ignored because the database is not active. I am not sure I am using the correct terminology here, but that was my problem in a nutshell.

Darth Vodka
04-14-2008, 04:10 AM
I tried to implement something hauntingly similar, and had hauntingly similar problems. Here is what I learned: if a person is logged into the database and then walks away, say to attend a several hour long meeting, their computer goes into "sleep" mode. If I happen "tick" the checkbox to kick users out, the person who has walked away doesn't get kicked out. I think the issue is that the timer (which I had on the Main Switchboard -- a form that the user cannot close unless they log out) gets ignored because the database is not active. I am not sure I am using the correct terminology here, but that was my problem in a nutshell.

aaaaah

i just asked the user (who it didn't even try to kick out) and she said she was away from her desk, so the screen-saver had kicked in

looks like you're right, thanks

how annoying, don't suppose anyone knows a way around it, if that is at all possible...?

hmm, found this

http://www.databasejournal.com/features/msaccess/article.php/3548586

maybe docmd.quit works better than application.quit?
or maybe i need a a parameter in there, Application.Quit acQuitSaveAll or DoCmd.Quit acQuitSaveNone type of thing...

or even CurrentDb.Close ?

LynnEsther
04-14-2008, 05:46 AM
Interesting. I downloaded the file and ran it, then locked my workstation and walked away. It logged me out! Sometime in the next few days I will incorporate this code into my system. I'll let you know if it works. Thanks for sharing that link. :D

Guus2005
04-14-2008, 06:04 AM
aaaaah

i just asked the user (who it didn't even try to kick out) and she said she was away from her desk, so the screen-saver had kicked in

looks like you're right, thanks

how annoying, don't suppose anyone knows a way around it, if that is at all possible...?

hmm, found this

http://www.databasejournal.com/features/msaccess/article.php/3548586

maybe docmd.quit works better than application.quit?
or maybe i need a a parameter in there, Application.Quit acQuitSaveAll or DoCmd.Quit acQuitSaveNone type of thing...

or even CurrentDb.Close ?Your link is a gem!

Yes, you could work around the part when a screensaver kicks in. Store the supposed logout time in a table. When the user tries to resume after a few hours, they are logged out. It doesn't prevent however the fact that the database was locked by the user.

HTH:D