Quit Application

Novice1

Registered User.
Local time
Today, 02:38
Joined
Mar 9, 2004
Messages
385
Here's what I want to do: At a specific time, I want to give the user a five warning to exit the database. After 5 minutes I want to kick the user off the database.

Here's what I tried: (1) Created a hidden form. On the hidden form using a Timer Interval of 300000, I placed an Event Procedure on the On Timer.

If (Time() >= #4:54:00 PM# And Time() <= #4:59:00 PM#) Then

Msgbox "Please exit this program within 5 minutes. System Maintenance is about to begin.", vbOKOnly

Else

If (Time() >= #5:00:00 PM# And Time() <= #1:00:00 AM#) Then

DoCmd.Quit

Else
End If
End If

The msgbox appears but the program doesn't exit.

Thinking the second part of the If/Then statement wouldn't run without input from the user, I decided not to use the msgbox ... just quit ... the code still doesn't exit.

Any help would be appreciated.
 
What time could possibly be both later than 5pm and earlier than 1am? ;)
 
Not sure I'm tracking you. How do I say between 5pm and 1am the next day?

Does the time only work until midnight of the present day?

:confused:
 
Time() returns the current time. This:

If (Time() >= #5:00:00 PM# And Time() <= #1:00:00 AM#) Then

is saying "if the current time is after 5pm AND the current time is before 1am". I suspect you want OR instead of AND.
 

Users who are viewing this thread

Back
Top Bottom