Results 1 to 5 of 5

Thread: Does anyone know how to...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Posts
    230
    Does anyone know of a way to run a procedure at specified time intervals, say hourly, without using the Timer control. The Timer control only allows for short time intervals (I think its 64000 milleseconds?). I guess you could nest the controls and have one elapsed interval initiate another Timer (and so on...) but this would be the brute force method. I am sure there is a more elegant way.

    shawn

  2. #2
    Member
    Join Date
    Mar 2000
    Location
    Mentor,Oh,US
    Posts
    33

    Unhappy

    You should probably just get the current system date/time using the DateDiff Function. Or just use DateAdd function and add an hour to the current system time.
    Need more?

    -deadBird

  3. #3
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    I asked that one a few months ago, everywhere I went said the ssame thing, to schedule any processes rather than the time control, use the winNT / win98 task scheduler.

    http://forums.vb-world.net/showthrea...threadid=23136

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    it depends what you want to do.

    the sheduler will run an app when sheduled but if you want the app to be running all the time and just run code periodically you can do this:



    Code:
    Option Explicit
    
    Dim Runtime As Date
    
    Private Sub Form_Load()
      resetRunTime
    End Sub
    
    Private Sub Timer1_Timer()
    
      If Now > Runtime Then
        resetRunTime
        DoYourStuff
      
      End If
    End Sub
    Private Sub resetRunTime()
       Runtime = DateAdd("n", 60, Now)
       
    End Sub
    
    Private Sub DoYourStuff()
    
    MsgBox "Enter code to run here"
    End Sub
    [Edited by Mark Sreeves on 10-03-2000 at 10:18 AM]
    Mark
    -------------------

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Posts
    230

    Smile

    Thanks deadBird for the start and thanks Mark for the example code. I wanted to keep a status board up all the time and have code update the board every hour. This code will do the trick.

    thanks,
    shawn

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