I just tested my function above, and it works just fine. You can run into the next day and the timer still goes off. You can also do other events within your own app and other applications (just don't unload your app).
I think it would probably be a good idea to create a global flag that would act as another test for the Do Loop, so that if your user shuts down your app before the timer expires, you end the loop.
example:
Code:Option Explicit Private mbFlag As Boolean Private Sub Form_Load() mbFlag = False End Sub Private Sub Form_Unload(Cancel As Integer) mbFlag = True End Sub Private Sub Wait(asSeconds As Single) ' ..... ' The code is the same until you get to the first loop: Do Until Date = ldDayHasArrived Or mbFlag = True DoEvents Loop ' ..... ' And again in the second loop: Do Until Timer >= lsTimesUp Or mbFlag = True DoEvents Loop End Sub




Reply With Quote