I have a system in place where I load a form named usysLogoutTimer which is loaded
at app startup. It polls a server table with a Yes/No field for Logout attribute. When
true, the countdown form, usysLogoutCountdown, displays itself and starts a 5 minute
countdown. That way, I can log out all users, even if it's after hours and they've gone home.
I put an image of the form at my site ...
http://amazecreations.com/datafast/countdown.jpg
And the code for both forms is down here ...
' usysLogoutTimer
Option Compare Database
Option Explicit
Private Sub cmdOK_Click()
On Error GoTo Err_Handler
Me.Visible = False
Exit_Here:
Exit Sub
Err_Handler:
LogErrorToTable Err.Number, Err.Description, "Form_usysLogoutTimer", "cmdOK_Click", Erl
Resume Exit_Here
End Sub
Private Sub Form_Timer()
On Error GoTo Err_Handler
Dim fLogout As Boolean
fLogout = DLookup("[LogOutAllUsers]", "[usysVersionServer]")
If fLogout = True Then
Me.TimerInterval = 60000
DoCmd.OpenForm "usysLogoutStatus"
Else
Me.TimerInterval = 1800000
If IsLoaded("usysLogoutStatus") Then
DoCmd.Close acForm, "usysLogoutStatus"
End If
End If
Exit_Here:
Exit Sub
Err_Handler:
'LogErrorToTable Err.Number, Err.Description, "Form_usysLogoutTimer", "Form_Timer", Erl
Resume Exit_Here
End Sub
' usysLogoutCountdown
Private Sub cmdOK_Click()
On Error GoTo Err_Handler
Me.Visible = False
Exit_Here:
Exit Sub
Err_Handler:
'LogErrorToTable Err.Number, Err.Description, "Form_usysLogoutCountdown", "cmdOK_Click", Erl
Resume Exit_Here
End Sub
Private Sub Form_Open(iCancel As Integer)
On Error GoTo Err_Handler
mdat_StartCountdownTime = DateAdd("n", 3, Now())
Me!txtMinsecs = " 3 minutes and 0 seconds "
Exit_Here:
Exit Sub
Err_Handler:
LogErrorToTable Err.Number, Err.Description, "Form_usysLogoutCountdown", "Form_Open", Erl
Resume Exit_Here
End Sub
Private Sub Form_Timer()
On Error GoTo Err_Handler
Dim intIMins As Integer
Dim intISecs As Integer
intIMins = DateDiff("s", Now(), mdat_StartCountdownTime) \ 60
intISecs = DateDiff("s", Now(), DateAdd("n", (intIMins * -1), mdat_StartCountdownTime))
If intIMins = 2 And intISecs = 0 Then
Me.Visible = True
End If
If intIMins = 1 And intISecs = 0 Then
Me.Visible = True
End If
If intIMins = 0 And intISecs = 20 Then
Me.Visible = True
End If
If intIMins <= 0 And intISecs <= 0 Then
DoCmd.Quit
End If
Me!txtMinsecs = " " & intIMins & " minutes and " & intISecs & " seconds "
Exit_Here:
Exit Sub
Err_Handler:
LogErrorToTable Err.Number, Err.Description, "Form_usysLogoutCountdown", "Form_Timer", Erl
Resume Exit_Here
End Sub
--
Danny J. Lesandrini
dl*********@hotmail.com http://amazecreations.com/datafast/
"John Ortt" <jo******@noemailsuppliedasdontwantspam.com> wrote in message news:43**********@glkas0286.greenlnk.net...
Hi Everyone, hope you can help.
Our company has recently migrated from NT and Access 97 to XP and Access 2003 and in the process a number of problems
have surfaced.
The team I work in are responsible for managing a number of databases, some of which are updated on a desktop machine
and then copied to the networked drives.
We overwrite the existing database with the new updated version using the scheduled task manager to ensure no-one is
in the database (i.e. midnight in a 9-5 office).
The problem arrises if for some reason we want to overwrite the database during the day.
In the days of NT we would firstly put a "quit" command in the autoexec to stop anyone else getting in the database
and then go about getting the remaining users out. To do this we would look at the machine ID's in the ".ldb" file
using either notepad or ldb viewer, and then use a net-send to the machine to request that the user exited the
database. This worked well and usually we could perform the entire task in less than 20 minutes.
Now that we have migrated everything has changed. Firstly we can't put the quit command in the database as you can't
change the design of an Access 2000+ database if there are other users in it. This means that we have to try to get
the users out even as new users are logging in. To make matters worse, for reasons I fail to understand net-send no
longer works on the XP machines. This means that the only way of getting people out is to enter the database and look
at our login table to find out who is using the relevant machine ID's and subsequently look up their phone number to
request that they exit the database. As you can imagine this is an extremely time consuming process. It is further
complicated as the database occasionally gets corrupted stopping anyone further getting in but not kicking the
existing users out. In this instance we can't even refer to the login table to find the names leaving us completely
helpless.
I have tried creating timer events which check an external linked table at a set interval to see whether to log off
which seems to work fine in a test environment but makes the database far more unstable when used on the network.....I
can post the code I used if you wish.
If anyone has any suggestions on how we can make any part of this process easier in XP I would be extremely grateful.
Thankyou,
John Ortt.