Results 1 to 6 of 6
  1. #1
    jax1000rr is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    26

    Need help with multiple OnTimer events

    Hello once again,

    I have searched and not been able to implement any code to do what I need.



    I need to have multiple timer events run on a single form, below is the code I have thus far and it is not working:

    Code:
    Static intCount As Integer
    intCount = intCount + 1
    If intCount = 1000 Then
    If DCount("*", "Qry_User_Active_Check") = 0 Then
    MsgBox "Your account has been disabled and you will now be logged out. Please contact your manager.", vbCritical, "Account Disabled"
    DoCmd.Quit
    Else
    If intCount = 180000 Then
    DoCmd.RunCommand acCmdRefreshPage
    End If
    End If
    End If

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    It would be helpful to the reader if you would tell us in plain English WHAT you are trying to do.
    Once readers understand the WHAT of the issue/opportunity, they often have suggestions/options as to HOW it can be achieved.

  3. #3
    jax1000rr is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    26
    Hi,

    Basically I need the timer to check every 30 seconds (I know the code I posted shows 1 second) to see if If DCount("*", "Qry_User_Active_Check") = 0 Then execute the command if it does. Then I also need a timer to run every 30 min and refresh the page.

    HTH

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Why doesn't it work - error message, wrong results, nothing happens?

    I think your nesting is wrong.

    Set the TimerInterval property to 1000. Have a textbox with DefaultValue of 0 on form to store accumulated time. Consider:
    Code:
    Private Sub Form_Timer()
    Dim intCount As Integer
    Me.Text81 = Me.Text81 + 1000
    intCount = Me.Text81
    If intCount = 1000 Then
        If DCount("*", "Qry_User_Active_Check") = 0 Then
            MsgBox "Your account has been disabled and you will now be logged out. Please contact your manager.", vbCritical, "Account Disabled"
            DoCmd.Quit
        End If
    ElseIf intCount = 18000  Then
        DoCmd.RunCommand acCmdRefreshPage
        Me.Text81 = 0
    End If
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    jax1000rr is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    26
    Thanks June7 and all, worked great...

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by jax1000rr View Post

    ...Then I also need a timer to run every 30 min and refresh the page...
    What is the point of this? Access, by Default, Refreshes data every 60 seconds! The time can be adjusted, by

    1. clicking on the Office Button (top, left)
    2. clicking on Access Options (bottom, right)
    3. clicking on Advanced (left-hand panel)
    4. Scrolling down to the 'Advanced' section
    5. Changing the Refresh Interval to whatever you want


    Linq ;0)>

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

Similar Threads

  1. Replies: 8
    Last Post: 05-25-2012, 11:49 AM
  2. Multiple events for a individual
    By nevets in forum Database Design
    Replies: 2
    Last Post: 02-18-2012, 12:54 PM
  3. Events are "Non-Events"
    By caddcop in forum Forms
    Replies: 4
    Last Post: 04-07-2011, 10:08 PM
  4. Different Events
    By jo15765 in forum Programming
    Replies: 2
    Last Post: 12-07-2010, 12:45 PM
  5. Multiple events per location Distance tables
    By flebber in forum Database Design
    Replies: 1
    Last Post: 03-13-2010, 08:48 PM

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