title: access dlookup multiple criteria Return Boolean And ordertype not equal to
body: <pre><code>Private Function AllowPurge(FileID As String) As Boolean
  Dim result As Boolean
  Dim i As Integer
  
  i = DLookup("COUNT(*)", "OrderMaster", "OrderStatus='S' AND FileID=" &amp; FileID, "AND OrderType='E'")
  If i &gt; 0 Then
      result = False
  Else
      result = True
  End If
  
  AllowPurge = result
  End Function
  </code></pre>
  
  <p>OrderStatus is either marked as shipped or open 'S' or 'O'.</p>
  
  <p>I need to:</p>
  
  <ul>
  <li>Allow purge - if every single order, other than E orders, are still open.</li>
  <li>Don't allow purge - if any order, other than an E order, is marked as shipped.</li>
  </ul>