Results 1 to 5 of 5
  1. #1
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105

    Form_Timer not running

    I'm trying to implement a basic idle timeout based on the MSDN article and I'm having an issue...

    My code is as follows:



    Code:
    Private Sub Form_Load()
        Me.TimerInterval = 1000
    End Sub
    
    
    Private Sub Form_Timer()
        Const conIdleMinutes = 10
        Static strPrevForm As String
        Static strPrevControl As String
        Dim strActiveForm As String
        Dim strActiveControl As String
        Dim timExpiredMinutes
        On Error Resume Next
        strActiveForm = Screen.ActiveForm.Name
        strActiveControl = Screen.ActiveControl.Name
        If Err Then
            strActiveForm = "No Active Form"
            Err = 0
        End If
        If strPrevForm = "" Or strPrevControl = "" Or strActiveForm <> strPrevForm Or strActiveControl <> strPrevControl Then
            strPrevControl = strActiveControl
            strPrevForm = strActiveForm
            TempVars!varexpiredtime = 0
        Else
            TempVars!varexpiredtime = TempVars!varexpiredtime + Me.TimerInterval
        End If
        timExpiredMinutes = (TempVars!varexpiredtime / 1000) / 60
        If timExpiredMinutes >= conIdleMinutes Then
            TempVars!varexpiredtime = 0
            DoCmd.OpenForm "frmTimeoutDialog"
        End If
    End Sub
    I open the form and the timer never runs... checking the values in the immediate window show that the variables are never assigned.
    It doesn't even appear that timerinterval is being defined... What am I doing wrong?
    I've done it in VBA above, as suggested, as well as tried the form properties.

    Access 2016.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    does ...
    the ON TIMER event have code in it?
    is TIMER INTERVAL set to at least 1000?
    does the code in the ON TIMER event function without errors?

  3. #3
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105
    Timer interval is set at 1000 (on the form properties AND also setting on form_load in VBA, just in case.)
    On Timer is set to [Event Procedure] which, when clicking the elipses generates the Form_Timer() sub, which is filled above.

  4. #4
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105
    I put the Form_Timer code in a new sub Test() and ran it... it worked.
    So it really seems to be that Form_Timer() simply isn't firing???

  5. #5
    sstiebinger is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    105
    I should note... this is on a navigation form... the frmTimeoutDialog form that's called at the end of the sub has a very similar setup but has buttons to cancel the idle timeout.
    That form comes up, and 5 minutes later (the timeout I set) that form closes the application.

    So is there possibly an issue with running timers on a navigation form?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Running Sum
    By BringTheR41n in forum Queries
    Replies: 2
    Last Post: 07-10-2014, 12:45 PM
  2. running sum
    By chavez_sea in forum Queries
    Replies: 1
    Last Post: 10-09-2013, 03:13 PM
  3. Replies: 5
    Last Post: 10-04-2013, 12:30 AM
  4. Running queries, VIA VB, but not running in Order
    By mike02 in forum Programming
    Replies: 6
    Last Post: 06-01-2013, 07:07 AM
  5. Running Sum
    By rpgowned in forum Queries
    Replies: 2
    Last Post: 08-30-2011, 10:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums