Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Getting a VBA procedure to wait a given time

    Is it possible to make a procedure wait a certain number of seconds before continuing to execute code?

  2. #2
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Getting a VBA procedure to wait a given time

    As long as you're not running the code over midnight:
    <pre>Sub tim()
    'Timer = number of seconds since midnight
    'This will give a delay of 5 seconds
    timenext = Timer + 5
    While Timer < timenext
    Wend
    End Sub
    </pre>


  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Getting a VBA procedure to wait a given time

    Thanks it works 100%.
    Could I ask you if you know how I can set a VBA procedure to run at a certain time of day? You could use your same code except that the system is locked out from doing anything other activity in Access (where I have put your code). Maybe I can used DoEvents?
    David

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Getting a VBA procedure to wait a given time

    Yes you can (I answered my own question).
    OK, then next project is to learn about using ActiveX exe
    stuff so (I hope) you could run several procedures in the one access project at once. Do you think this might be possible?

  5. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Getting a VBA procedure to wait a given time

    I don't know if you can run multiple procedures in VBA at the same time. Perhaps as a work around you could open multiple instances of Access which could possibly run concurrent processes to get the same result.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

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