Results 1 to 3 of 3

Thread: [RESOLVED] timer interval

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2009
    Posts
    98

    Resolved [RESOLVED] timer interval

    how to set timer interval in minutes.
    Any one

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: timer interval

    You would initially set Interval = 60000 which is 1 minute.
    On Timer event you can increment integer variable and when its value is equal to whatever number you need you'll do something and reset the counter to zero.
    You counter vaiable can be declare at the form level or as Static directly in the procedure (timer event handler).

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: timer interval

    Code:
    Option Explicit
    Private lngMinutes As Long
    Private intInterval As Integer
    
    Private Sub Command1_Click()
    
        intInterval = 2 ' Set this to the desired number of minutes
        Timer1.Enabled = True
        
    End Sub
    
    Private Sub Form_Load()
    
        Timer1.Interval = 60000 ' set to one minute
        Timer1.Enabled = False
        
    End Sub
    
    Private Sub Timer1_Timer()
    
        lngMinutes = lngMinutes + 1
        If lngMinutes = intInterval Then
            lngMinutes = 0
            Debug.Print "Timer fired at " & Time
            ' Put the code (or a call to the code) you want to execute here
        End If
        
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width