title: Access VBA: If Form Value <> NULL then run query else, end if. - not doing anything
body: <p>I have a piece of code that I've haphazardly written in order to run a query on_click of a form button.</p>
  
  <pre><code>Private Sub Command153_Click()
  If Forms![form name1]![form name2]!Text143 &lt;&gt; Null Then
  DoCmd.OpenQuery "InsertGroup", acNormal, acEdit
  Else
  End If
  End Sub
  </code></pre>
  
  <p>I haven't written a custom if before in VBA so I think I'm probably just getting this wrong as it is literally not doing anything (No errors or anything, I assume its just not running the query). I know that the query I'm calling in works fine as if I simply get the on_click to run the query without the if, I have no problems whatsoever.
  I'm also referencing the correct textbox and have tried this both with and without test data in the text box.</p>
  
  <p>Any help is greatly appreciated! </p>
  
  <p>Regards,</p>
  
  <p>Andy.</p>