Timed loop

MartynE

Registered User.
Local time
Today, 10:43
Joined
Mar 27, 2013
Messages
49
Hi,

I'm trying to build a sort of closing application so that my boss can kick everyone out of the Access program. I want to do this with a check button that can be put as true by the boss which will close everyone's open application.
It must be done by some 30 min loop that checks if the checkbox is true or not.

So far I have come to this:

Code:
' To make it pause for half an hour before continuing 
Public Function Pause(NumberOfSeconds As Variant)
On Error GoTo Err_Pause

    Dim PauseTime As Variant, start As Variant

    PauseTime = NumberOfSeconds
    start = Timer
    Do While Timer < start + PauseTime
    DoEvents
    Loop

Exit_Pause:
    Exit Function

Err_Pause:
    MsgBox Err.Number & " - " & Err.Description, vbCritical, "Pause()"
    Resume Exit_Pause

End Function

Private Sub Form_Open(Cancel As Integer)

    If Me.Stoppennw = True Then
    Application.Quit
    ElseIf Me.Stoppennw = False Then
    Pause (1800)
    ' No idea how I build in the loop here to make it look at the checkbox again
    End If
I'm just a bit stuck here since I have no experience with loops at all.
My guess and my hope is that this is child's play for some of you :p

Thanks
 
What I forgot to say is that when you start the application it first checks if it's True, if so then the app will close right away. After that the 30 min loop has to come into play.
 
The function seems to 'Wait' for 30 minutes, to trigger the Event every thirty minutes, you need Form OnTimer event..
 
I was again thinking it the hard way, thanks a lot
 

Users who are viewing this thread

Back
Top Bottom