Private Sub Form_Open(Cancel As Integer)[/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman] ' Set Count Down variable to false[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' on the initial opening of the form.[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] boolCountDown = False[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] Dim strFileName As String[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] strFileName = Dir("\\mb.talk-dns.com\mmpmetro\mn157h\blhm\SHARE\CounterParty Risk\Corey\Enabled1.db\enabled.db")[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] If strFileName <> "Enabled.db" Then[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] MsgBox "Database being updated, please try again later."[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] Application.Quit acQuitSaveAll[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] End If[/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman]End Sub[/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman]Private Sub Form_Timer()[/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman]On Error GoTo Err_Form_Timer[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] Dim strFileName As String[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] strFileName = Dir("\\mb.talk-dns.com\mmpmetro\mn157h\blhm\SHARE\CounterParty Risk\Corey\Enabled1.db\enabled.db")[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] If boolCountDown = False Then[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' Do nothing unless the check file is missing.[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] If strFileName <> "Enabled.db" Then[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' The check file is not found so[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' set the count down variable to true and[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' number of minutes until this session[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' of Access will be shut down.[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] boolCountDown = True[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] intCountDownMinutes = 2[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] GoTo Warningform[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] End If[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] Else[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' Count down variable is true so warn[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' the user that the application will be shut down[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' in X number of minutes. The number of minutes[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' will be 1 less than the initial value of the[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' intCountDownMinutes variable because the form timer[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' event is set to fire every 60 seconds[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] intCountDownMinutes = intCountDownMinutes - 1[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]Warningform:[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] DoCmd.OpenForm "frmAppShutDownWarn"[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] Forms!frmAppShutDownWarn!txtWarning = "Due to database maintenance this application will automatically shut down in approximately " & intCountDownMinutes & " minute(s). Please save all work and close the database ASAP."[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] If intCountDownMinutes < 1 Then[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' Shut down Access if the countdown is zero,[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] ' saving all work by default.[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] Application.Quit acQuitSaveAll[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] End If[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] End If[/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman]Exit_Form_Timer:[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] Exit Sub[/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman]Err_Form_Timer:[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman] Resume Next[/FONT][/SIZE]
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]
[FONT=Times New Roman][SIZE=3]End Sub