[AccessD] Force Closing the FE

Kovacs, Bruce bruce.kovacs at urs.com
Mon Feb 14 15:44:02 CST 2011


Jennifer,

The following is what I use:

Sub IdleTimeDetected(ExpiredMinutes)

    gIdleTimeExceeded = True
    DoCmd.Close acForm, "aSwitchboardMain"
    Application.Quit acQuitSaveNone

End Sub

The gIdleTimeExceeded global variable is used in the Unload event of my form aSwitchboardMain to append the word "IDLE" to one of the fields in my database entry/exit log table.  That gives me an indication of who the "offenders" are.



Bruce Kovacs
URS Corporation

SGT, LLC
7207 IBM Drive
Charlotte, NC  28262

Office:  704-805-2131
Fax:  704-805-2875
Cell:  704-200-8802
bruce.kovacs at urs.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 04:28 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Force Closing the FE

Thanks Bruce.  The code has a MsgBox that requires a user action.  One of the things I want to get around is users leaving the FE open when they leave for the day.  I want it to shut down.  Do you see a problem with me bypassing the MsgBox and just doing an Application.Quit once the timer has expired?

Jennifer

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kovacs, Bruce
Sent: Monday, February 14, 2011 1:20 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Force Closing the FE


Typically 60 minutes.  There was one jobsite with a challenged server where I went down to 20 minutes, as I recall (this site also had 3 different FEs hitting the one BE, and with 15 to 20 concurrent users).  And I had a very stable office application with only 3 users where I went up to 120 minutes.


Bruce Kovacs
URS Corporation

SGT, LLC
7207 IBM Drive
Charlotte, NC  28262

Office:  704-805-2131
Fax:  704-805-2875
Cell:  704-200-8802
bruce.kovacs at urs.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 04:09 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Force Closing the FE

What do you typically set the timer interval for?

Jennifer

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kovacs, Bruce
Sent: Monday, February 14, 2011 11:22 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Force Closing the FE


I have used this same code in all of my databases since at least 07-Feb-02, and have had no problems.  I tied it to a table where I can set the idle time limit depending on the particular installation location.

Likewise, I did not keep track of where I got this.




Bruce Kovacs
URS Corporation

SGT, LLC
7207 IBM Drive
Charlotte, NC  28262

Office:  704-805-2131
Fax:  704-805-2875
Cell:  704-200-8802
bruce.kovacs at urs.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 01:35 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Force Closing the FE

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

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com ________________________________ This e-mail and any attachments contain URS Corporation confidential information that may be proprietary or privileged. If you receive this message in error or are not the intended recipient, you should not retain, distribute, disclose or use any of this information and you should destroy the e-mail and any attachments or copies.

--
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 ________________________________  This e-mail and any attachments contain URS Corporation confidential information that may be proprietary or privileged. If you receive this message in error or are not the intended recipient, you should not retain, distribute, disclose or use any of this information and you should destroy the e-mail and any attachments or copies.

--
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
________________________________
 This e-mail and any attachments contain URS Corporation confidential information that may be proprietary or privileged. If you receive this message in error or are not the intended recipient, you should not retain, distribute, disclose or use any of this information and you should destroy the e-mail and any attachments or copies.




More information about the AccessD mailing list