Hi all,
I am trying to create a button to kick users(everyone including myself) out from database. My database is stored in the shared folder on the network. Currently, I realised that my code would only kick myself out. The code is written below
I am trying to create a button to kick users(everyone including myself) out from database. My database is stored in the shared folder on the network. Currently, I realised that my code would only kick myself out. The code is written below
Code:
Option Compare Database
Public Loops As Integer
Private Sub Form_Load()
Me.TimerInterval = 1000
Call Form_Timer
End Sub
Private Sub Form_Timer()
Static StartTime As Date
Dim SecondsToCount As Integer
Dim Min As Integer
Dim Sec As Integer
SecondsToCount = 15 'Set this variable to the total number of seconds to count down
If Loops = 0 Then StartTime = Time
Min = (SecondsToCount - DateDiff("s", StartTime, Time)) \ 60
Sec = (SecondsToCount - DateDiff("s", StartTime, Time)) Mod 60
Me.TimeLeft.Caption = "Due to maintenance,database will close in " & Min & ":" & Format(Sec, "00")
Loops = Loops + 1
If Me.TimeLeft.Caption = "Due to maintenance,database will close in 0:00" Then
Application.Quit acQuitSaveAll
End If
End Sub