title: Testing if a string is null
body: <p>I am pretty new in VBA and I have not yet got used to the syntax completely, so I'm sorry if my question sounds stupid.</p>
  
  <p>I am working with RequisitePro40 and VBA 7.0 in Word 2010. In one of my modules I have the following loop and If conditions:</p>
  
  <pre><code>Dim rqRequirements As ReqPro40.Requirements
  Dim rqRequirement As ReqPro40.Requirement
  Const eAttrValueLookup_Label = 4
  Dim a As Integer
  ...
  
  For Each vReqKey In rqRequirements
      Set rqRequirement = rqRequirements(vReqKey)
  
      If rqRequirement.AttrValue("MyAttreName", eAttrValueLookup_Label).text &lt;&gt; Null Then
          a = 1
      End If
  
      If rqRequirement.AttrValue("MyAttreName", eAttrValueLookup_Label).text = Null Then
           a = 2
      End If
  
   Next
  </code></pre>
  
  <p>In each iteration of the loop, both <strong>a = 1</strong> and <strong>a = 2</strong> are executed!!</p>
  
  <p>Based on <a href="https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/comparison-operators" rel="nofollow noreferrer">This</a>, the equality and inequality operators are "=" and "&lt;>". Therefore I would expect that either <strong>a = 1</strong> or <strong>a = 2</strong> execute for a string.
  Is there something wrong with my syntax? Or is it a ReqPro related Problem?</p>
  
  <p>I also tried using "Is" and "IsNot" operators but they result in Compiler error: Type mismatch</p>
  
  <p>Can Someone help me with this?</p>
  
  <p><strong>Update:</strong> The actual goal is to see if the</p>
  
  <blockquote>
    <p>rqRequirement.AttrValue("MyAttreName", eAttrValueLookup_Label).text</p>
  </blockquote>
  
  <p>is Null or not. I added the second if to show the problem that the statement is somehow not working the way I expect it to work.</p>
  
  <p>Replacing "Null" to "vbNullString" did not make any changes.</p>
  
  <p>I also tried the IsNull function as @Slai suggested. the result is pretty much the same:</p>
  
  <pre><code>    If IsNull(rqRequirement.AttrValue(att, eAttrValueLookup_Label).text) Then
          a = 3
      End If
  
      If Not IsNull(rqRequirement.AttrValue(att, eAttrValueLookup_Label).text) Then
          a = 4
      End If
  </code></pre>
  
  <p>Both statements <strong>a = 3</strong> and <strong>a = 4</strong> are true and executed.</p>