title: "Data type mismatch in criteria expression" when doing SQL subquery in Access 2010
body: <p>Here is my simplified code (little more than some basic elements to cause the SQL not to execute):</p>
  
  <pre><code>select *
  from (
      select replace(mytxtfield, "llama", "") as badones 
      from XYZ
  )
  where badones is not null;
  </code></pre>
  
  <p>The outer query runs fine when the WHERE cause is:</p>
  
  <pre><code> badones like "ZZZ-[0-9][0-9][0-9]"
  </code></pre>
  
  <p>but it breaks when the WHERE cause includes more than one LIKE (of any digit matching pattern) such as:</p>
  
  <pre><code>badones like "ZZZ-[0-9][0-9]" OR 
  badones like "ZZZ-[0-9][0-9][0-9]"
  </code></pre>
  
  <p>More info:</p>
  
  <ul>
  <li>mytxtfield is of type Text</li>
  <li>It doesn't matter if there is a WHERE cause in the inner query to check eliminate null / empty strings. </li>
  <li>64-bit office</li>
  </ul>