ClearlyDarkly
New Member
- Joined
- Apr 20, 2016
- Messages
- 1
Hello
Long time lurker, New Member, i just wanted to show you my KillSwitchCode for use with a New Split/End MultiUser Access Database, I have been coding for less that half a year (trying to get onto a training course) and just wanted to hear your opinions and concerns regarding using it.
Kill Switch Code
The Idea of this code is to give a 2 minute warning to employees that they need to come out of the Database and that it will auto close if they stay in it (Compact & Repairing), Also have AutoBots doing stuff on webpages (Selenium Wrapper) and using a emulator for automation purposes.
The Code comes in 4x Parts and 1x Table.
---> This is on a 1 Minute Timer to check if a Tick Box is Ticked in Tbl_KillSwitchEngage, Form needs to be loaded but can be hidden, This is a Logon Form
---> This is a Button that Ticks the Tick box in Tbl_KillSwitchEngage
---> This is a Warning Form with a Timer on for 2 Minutes, once 2 minutes reached, Database will Close, Won't Close but can be hidden.
---> This is the OK Button to hide the Warning Form
My concerns are:
1. The Database will not close cleanly causing a corruption,
2. In order to stop the database from initiating the kill-switch you have to delete the record out of the Tbl_KillSwitch, this to also change
3. InputPassword is "HardCoded" this will change.
4. Shift Clickers won't get the popup as the Login Form won't Load.
Long time lurker, New Member, i just wanted to show you my KillSwitchCode for use with a New Split/End MultiUser Access Database, I have been coding for less that half a year (trying to get onto a training course) and just wanted to hear your opinions and concerns regarding using it.
Kill Switch Code
The Idea of this code is to give a 2 minute warning to employees that they need to come out of the Database and that it will auto close if they stay in it (Compact & Repairing), Also have AutoBots doing stuff on webpages (Selenium Wrapper) and using a emulator for automation purposes.
The Code comes in 4x Parts and 1x Table.
---> This is on a 1 Minute Timer to check if a Tick Box is Ticked in Tbl_KillSwitchEngage, Form needs to be loaded but can be hidden, This is a Logon Form
Code:
Private Sub Form_Timer()
Dim KillSwitchRST As DAo.Recordset
Set KillSwitchRST = CurrentDb.OpenRecordset("Select * FROM Tbl_KillSwitchEngage")
If KillSwitchRST.RecordCount > 0 Then
DoCmd.OpenForm "Frm_KillSwitchEngage", acNormal, , , , acWindowNormal
End If
KillSwitchRST.Close
Set KillSwitchRST = Nothing
End Sub
---> This is a Button that Ticks the Tick box in Tbl_KillSwitchEngage
Code:
Private Sub KillSwitchEngage_Click()Dim KillSwitchRST As DAo.Recordset
Dim InputPassword As String
Dim PasswordCheck As String
InputPassword = "Choose a Password"
PasswordCheck = InputBox("Please enter the password to run this command", "Password Required")
If InputPassword = PasswordCheck Then
Set KillSwitchRST = CurrentDb.OpenRecordset("Select * FROM Tbl_KillSwitchEngage")
KillSwitchRST.AddNew
KillSwitchRST!EngageKillSwitch = True
KillSwitchRST.Update
KillSwitchRST.Close
Set KillSwitchRST = Nothing
Else
MsgBox "The password you have entered is incorrect, Please retry or contact the system administrator"
End If
End Sub
---> This is a Warning Form with a Timer on for 2 Minutes, once 2 minutes reached, Database will Close, Won't Close but can be hidden.
Code:
Private Sub Form_Timer()
DoCmd.Quit
End Sub
---> This is the OK Button to hide the Warning Form
Code:
Private Sub OKButton_Click()
Form_Frm_KillSwitchEngage.Visible = False
End Sub
My concerns are:
1. The Database will not close cleanly causing a corruption,
2. In order to stop the database from initiating the kill-switch you have to delete the record out of the Tbl_KillSwitch, this to also change
3. InputPassword is "HardCoded" this will change.
4. Shift Clickers won't get the popup as the Login Form won't Load.