Private Sub Timer1_Timer()
dEndTime = Now()
sCancelTime = FormatDateTime(Now, vbShortTime)
If iShutdownCounter > 4 Then
With rsTempRecordSet
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = cnCMS
.LockType = adLockOptimistic
.Source = "SELECT * from company "
.Open
If .Fields("shutdownindicatorDrNetwork") = "1" Then
Call ManualShutDown
End If
iShutdownCounter = "0"
End With
Else
iShutdownCounter = iShutdownCounter + 1
End If
' Ckeck the time. If it falls in the range send a message, log the activity, end the application.
If sCancelTime > "02:00" And sCancelTime < "02:15" Then
txtMessage = "You have been automatically logged off of DrNetwork. Please " _
& "remember to log off before leaving for the day."
Call sGetComputerName
iMsgNumber = Shell(Environ$("COMSPEC") & " /C " & "Net Send " _
& sGetComputerName & " " & txtMessage)
Call RecordLogin("NightlyShutDown", Now(), "ShutDown")
Call cnCms_Close
End
End If
Exit Sub
End Sub