Automatically Requery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sc5502
    New Member
    • Jun 2014
    • 102

    Automatically Requery

    MS Access 2010/VBA

    The users of the attached query want a third button added that when pushed will cause the query to re-query itself automatically every 3 minutes. How can I do this? Thanks in advance.
    Attached Files
  • jforbes
    Recognized Expert Top Contributor
    • Aug 2014
    • 1107

    #2
    Put the requery code into the Form_Timer event. Then in the new Button's click event, set the Forms timer interval to 3000. ...3000 because the Form Timer uses milliseconds.

    I use the following for a Checkbox to toggle a timer off and on:
    Code:
    Private Sub chkTimer_AfterUpdate()
        If Me.chkTimer.Value Then
            Me.TimerInterval = nTimerInterval
        Else
            Me.TimerInterval = 0
        End If
    End Sub

    Comment

    • twinnyfo
      Recognized Expert Moderator Specialist
      • Nov 2011
      • 3662

      #3
      P.S. For a three minute interval, TimerInterval should be 180000 (3 minutes, x 60 seconds x 1000 milliseconds).

      Comment

      • jforbes
        Recognized Expert Top Contributor
        • Aug 2014
        • 1107

        #4
        Haha, nice catch Twinnyfo!

        Comment

        Working...