Results 1 to 4 of 4

Thread: Run procedure at specific time

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Run procedure at specific time

    I have an application that runs 24/7 and there is a procedure in that project that can be run by the press of a button. However, it needs to be pushed at 7AM every morning and I want to automate that process (running the procedure).

    I've throught about setting up a timer, but that has to check every minute for the time. Then I thought about splitting the procedure out into a small second app, but that complicates the installation elsewhere.

    Does anyone know of a good way to do this?
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Run procedure at specific time

    use a timer... nothing wrong with that.. used to do it all the time with access

    set the timer interval to 30000 (30 seconds) or 60000(1 minute)

    then test if the time > #7:00:00 AM# ....
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Re: Run procedure at specific time

    Ok... but every minute after 7AM, that's going to run. How do I only get it to run once? I'd have to set it so that if it's 7:00 and not worry about the seconds.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Run procedure at specific time

    well.. u cant set it to be

    if time = 7.. cause there is the chance it will miss the exact time and not run

    try somethinglike this...

    you need to track the day and if it has run....

    VB Code:
    1. Dim currDate As Date
    2. Dim RanIt As Boolean
    3.  
    4. Private Sub Form_Load()
    5.     currDate = Date
    6. End Sub
    7.  
    8. Private Sub Timer1_Timer()
    9.     If currDate <> Date Then
    10.         RanIt = False
    11.         currDate = Date
    12.     End If
    13.    
    14.     If Time > #7:00:00 AM# And Not RanIt Then
    15.         RanIt = True
    16.         'RUN CODE
    17.     End If
    18.    
    19. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

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