title: If String Value is empty, 0 , or Null MS Access, SQL, VBA
body: <p>I'm trying to get figure out a work around for this coding.</p>
  
  <p>Essentially this code checks the values of fields in Table CFRRR if <code>program</code> and <code>language</code> match the values in table attendance <code>Programs</code> and <code>Language</code>.</p>
  
  <p>This normal code works. However, if there is not a matching value for <code>language</code> then the code continues to just loop.</p>
  
  <p>I want to adjust the code to go to the next <code>strSQL</code> if there is no matching <code>language</code>, but I can't get it to run through the next <code>strSQL</code>.</p>
  
  <p>I think my error is that I am not writing the <code>IF/THEN</code> statement correctly. Here's the code:</p>
  
  <pre><code>a = Program
  b = language
  
  strSQL = "SELECT TOP 1 userID FROM attendance where attendance.Programs LIKE '*" &amp; a &amp; "*' AND attendance.Language LIKE '*" &amp; b &amp; "*' AND Status = 'Available' AND attendance.Tracking = 0"
  
  Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
  
  If strSQL = Null Then
      strSQL = "SELECT TOP 1 userID FROM attendance where attendance.Programs LIKE '*" &amp; a &amp; "*' AND Status = 'Available' AND attendance.Tracking = 0"
      Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
  End IF
  </code></pre>
  
  <p>Thank you :)</p>