title: IF 'AND' and 'OR' Statements
body: <p>My code is as follows:    </p>
  
  <pre><code>If (InStr(1, "ALL", Itype) Or InStr(1, Uvar.Device, Itype)  _
  And (InStr(1, "ALL", Isec) Or InStr(1, Uvar.Sec, Isec)) _
  And (InStr(1, "ALL", Idev) Or InStr(1, Uvar.Model, Idev)) Then Useline = "TRUE"
  </code></pre>
  
  <p>To expand on this a bit:</p>
  
  <p>Itype is a long string, e.g. -</p>
  
  <ul>
  <li><code>Itype = All, Apple, Pear, Orange</code> </li>
  <li><code>Isec = dog, cat, duck</code></li>
  <li><code>Idev = tree, flower, plant</code></li>
  </ul>
  
  <p>Each UVar.x is a single word, e.g. -</p>
  
  <ul>
  <li><code>UVar.Device = Apple</code></li>
  <li><code>UVar.Sec = Cat</code></li>
  <li><code>UVar.Model = tree</code></li>
  </ul>
  
  <p>So, if Itype contains the string "All" or it contains the value of UVar.Device 
  and Isec also contains the string "All" or it contains the value of UVar.Sec
  and IDev also contains the string "All" or it contains the value of UVar.Model</p>
  
  <p>then I want to have the <code>if statement = true</code>.</p>
  
  <p>My code above seems to return true whatever values are used, as long as at least one value criteria set matches. </p>
  
  <p>Thus, do the strings IType, Idev and Isec each contain either the value "all" or a specific user defined value? </p>