title: popup message shown while form closing
body: <p>I have a database with the following</p>
  <ul>
  <li>Mainfrm Form (Main Form - it has popup messages on load event)</li>
  <li>kikThemOut Form (Loads hidden with Main Form and every 5 sec it checks for field value on table if it is 1 then call the Function fGetOut())</li>
  <li>GetOutMod Module (has fGetOut() Function)</li>
  </ul>
  <p>it works all fine, except when application closing it loads the popup alerts from Mainfrm again! which should not load.</p>
  <p><strong>Mainfrm Form Code</strong>
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Private Sub Form_Load()
  
  
       'to check for T&amp;I notifications
  Dim trs As Recordset
      Set trs = CurrentDb.OpenRecordset("Y22_CurrMonth")
      
      If trs.EOF = False Then
          Dim tMsg, tStyle, tTitle, tHelp, tCtxt, tResponse, tMyString
          
  tMsg = "There are Notifications Due, Do you want to view them?"
  tStyle = vbYesNo + vbExclamation + vbDefaultButton2
  tTitle = "Notifications Alert"
  tHelp = "DEMO.HLP"
  tCtxt = 1000
  tResponse = MsgBox(tMsg, tStyle, tTitle, tHelp, tCtxt)
  If tResponse = vbYes Then    ' User chose Yes.
      DoCmd.OpenReport "Notifications Current Month", acViewReport, acWindowNormal
  
  Else
  tMyString = "No"
  End If
  End If
  
  'to load the checker form
  DoCmd.OpenForm "kikThemOut", , , , , acHidden
  
  End Sub</code></pre>
  </div>
  </div>
  </p>
  <p>and this is the GetOutMod Module to force users to exit the db
  <strong>GetOutMod Module</strong>
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Option Compare Database
  Option Explicit
  
  Function fGetOut() As Integer
  Dim RetVal As Integer
  Dim db As DAO.Database
  Dim rst As Recordset
  On Error GoTo Err_fGGO
  Set db = DBEngine.Workspaces(0).Databases(0)
  Set rst = db.OpenRecordset("KickEmOff", dbOpenSnapshot)
  If rst.EOF And rst.BOF Then
   RetVal = True
   GoTo Exit_fGGO
  Else
   If DSum("GetOut", "KickEmOff") = "1" Then
        Application.Quit
   Else
    RetVal = True
   End If
  End If
  Exit_fGGO:
   fGetOut = RetVal
   Exit Function
  Err_fGGO:
   'Note lack of message box on error
   Resume Next
  End Function</code></pre>
  </div>
  </div>
  </p>
  <p>And this code in the load event of kikThemOut form to check for the same condition, if it is 1 then load this popup message (I could not add popup message to my GetOutMod Module with the function fGetOut)</p>
  <p><strong>kikThemOut form Code</strong>
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Private Sub Form_Timer()
  If DSum("GetOut", "KickEmOff") = "1" Then
       Set TaskDialogAC = New cTaskDialog
      With TaskDialogAC
          .Init
          .MainInstruction = "Dashboard Maintenance"
          .Flags = TDF_CALLBACK_TIMER
          .Content = "The Dashboard will be closed after 20 seconds for maintenance"
          .CommonButtons = TDCBF_CLOSE_BUTTON
          .IconMain = IDI_WINLOGO
          .Footer = "Closing in 20 seconds..."
          .Title = "Dashboard Maintenance"
          .AutocloseTime = 20    'seconds
          .ParenthWnd = Me.hwnd
          .ShowDialog
      End With
      Call fGetOut
      Else
  If DSum("GetOut", "KickEmOff") = "0" Then
  DoCmd.Requery
     
    End If
     End If
  End Sub</code></pre>
  </div>
  </div>
  </p>