Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Posts
    313

    Unanswered: Every 5 mins update

    Hi,

    when open the database, I want the function to run forever until close the database.

    I try to the function in the macro and called AutoExec
    because it start to run when opent the database.

    The function is transferring the data to another table every 5 mins

    So, how do I set every 5 mins to run the function?

    Because there are 4 mins do need to run. when count 5 mins, then it runs.

    So, I don't have idea.

    Please let me know, thanks.

  2. #2
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    Does this db need to be doing other things while the clock is ticking?

    Either way, create a form with a text box on it.

    Create an On Open event to make the value of the text box = 5
    Set the Timer Interval property to 60000 (60000 milliseconds in a minute)
    Create an On Timer event to take the value of the text box and subtract 1. If the result is > 0, put the new value back in the text box and exit. If the result is 0, put 5 in the text box and run your routine.

    The purpose of the text box (instead of using a Timer Interval of 300000) is to make it easier to adjust the time.

    Providing the process you are running that takes 4 minutes does not prevent the on timer event from firing, it should work fine. If the process does prevent the on timer event from firing, then skip the count down - leave the timer at 1 minute and simply run the process again on the timer event (if the process ties it up for 4 minuntes and then the timer waits 1 minute - there's your 5 minutes).

    Some people will wonder why I didn't use the Timer function (which gives you the number of seconds since midnight). I assume this will run past midnight and I didn't feel like fiddling with the roll over. The Time function could be used as well. Also, the Now function would take into account the date, which would level the midnight issue.

    As always - many ways to peel the apple.
    have fun!

    Todd S.
    click to email


    Independent Development Consultant
    Biz db & reports - SQL, Access, Crystal, Seradex and more
    Small, custom, unique programs - Office, VBA, .NET


    _________________________________________________
    Favorite message from Windows:
    There was an error displaying the previous error message

    Sadly, there was no error number to look up ...

Posting Permissions

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