Force exit in shared Access Database with timers


/ Published in: Visual Basic
Save to your folder(s)

Takes place in 3 different forms: Entry Form, KeepOpen, and ForceOut


Copy this code and paste it in your HTML
  1. Private Sub Form_Load()
  2.  
  3. DoCmd.OpenForm "frmKeepOpen", acNormal, , , , acHidden
  4.  
  5. Forms!frmKeepOpen!ForceOutCheck.Value = ""
  6. If DCount("*", "tblForceOut", "[Force Out?] = 'Y'") = 1 Then
  7. DoCmd.Quit
  8. End If
  9.  
  10. End Sub
  11.  
  12.  
  13. Private Sub Form_Load()
  14.  
  15. Me.TimerInterval = 300000
  16.  
  17. End Sub
  18.  
  19. Private Sub Form_Timer()
  20.  
  21. If DCount("*", "tblForceOut", "[Force Out?] = 'Y'") = 1 And Forms!frmKeepOpen!ForceOutCheck.Value = "Y" Then
  22. DoCmd.Quit
  23. ElseIf DCount("*", "tblForceOut", "[Force Out?] = 'Y'") = 1 Then
  24. DoCmd.OpenForm "frmForceOut", acNormal, , , acFormReadOnly, acWindowNormal
  25. Me.TimerInterval = 60000
  26. End If
  27.  
  28. End Sub
  29.  
  30.  
  31. Private Sub Form_Load()
  32.  
  33. Forms!frmKeepOpen!ForceOutCheck.Value = "Y"
  34.  
  35. End Sub

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.