Jennifer Gross
jengross at gte.net
Mon Feb 14 12:35:13 CST 2011
Perfect. Thanks Rocky and Jim - you've given me options to look at. Jennifer -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin Sent: Monday, February 14, 2011 10:23 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Force Closing the FE This is someone else's code - can't remember where I got it but it works. You open a form hidden and it runs in the background with a timer event with this code: Option Compare Database Option Explicit Private Sub Form_Timer() ' IDLEMINUTES determines how much idle time to wait for before ' running the IdleTimeDetected subroutine. Static PrevControlName As String Static PrevFormName As String Static ExpiredTime Dim ActiveFormName As String Dim ActiveControlName As String Dim ExpiredMinutes Dim IDLEMINUTES As Double IDLEMINUTES = 10 On Error Resume Next ' Get the active form and control name. ActiveFormName = Screen.ActiveForm.Name If Err Then ActiveFormName = "No Active Form" Err = 0 End If ActiveControlName = Screen.ActiveControl.Name If Err Then ActiveControlName = "No Active Control" Err = 0 End If ' Record the current active names and reset ExpiredTime if: ' 1. They have not been recorded yet (code is running ' for the first time). ' 2. The previous names are different than the current ones ' (the user has done something different during the timer ' interval). If (PrevControlName = "") Or (PrevFormName = "") _ Or (ActiveFormName <> PrevFormName) _ Or (ActiveControlName <> PrevControlName) Then PrevControlName = ActiveControlName PrevFormName = ActiveFormName ExpiredTime = 0 Else ' ...otherwise the user was idle during the time interval, so ' increment the total expired time. ExpiredTime = ExpiredTime + Me.TimerInterval End If ' Does the total expired time exceed the IDLEMINUTES? ExpiredMinutes = (ExpiredTime / 1000) / 60 If ExpiredMinutes >= IDLEMINUTES Then ' ...if so, then reset the expired time to zero... ExpiredTime = 0 ' ...and call the IdleTimeDetected subroutine. IdleTimeDetected ExpiredMinutes End If End Sub Sub IdleTimeDetected(ExpiredMinutes) Dim Msg As String Msg = "No user activity detected in the last " Msg = Msg & ExpiredMinutes & " minute(s)!" MsgBox Msg, vbCritical Application.Quit End Sub HTH Rocky Smolin Beach Access Software 858-259-4334 Skype: rocky.smolin www.e-z-mrp.com www.bchacc.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jennifer Gross Sent: Monday, February 14, 2011 9:58 AM To: AccessD List Subject: [AccessD] Force Closing the FE Hi Everyone, I have a distributed FE linked to a common BE, with no control over force closing the FE from a network perspective. Is there a way to put a timer on the FE so that if it stands idle for an hour or so, or if a certain time passes, say 7 PM or midnight, that the FE will Exit? That way I can be reasonably assured that all FE are closed and the lock on the BE will be released for maintenance. I have always had some sort of network control over getting into a user's workstation once the culprit has been identified and closing down the FE, so I've never been faced with this issue. Am wondering how you all handle it. Thanks in advance for your help. Jennifer Gross -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com