title: Run SQL Statement in Access using VBA code
body: <p>I can't figure out what is wrong in this,
  I'm collecting search criteria from a Form to use it in search.</p>
  
  <p>The SQL line stored like this : (strWhere is the collected info from the Form)</p>
  
  <blockquote>
    <p>SQLst = "SELECT Deposits.Fines, Deposits.[Deposit Value], Deposits.[Deposit Date], Deposits.Depositor, Info.Tower, Deposits.[Account Number] FROM Info, Deposits Where " &amp; strWhere &amp; ";"</p>
  </blockquote>
  
  <p>The final SQL statement looks like this:</p>
  
  <blockquote>
    <p>SELECT Deposits.Fines, Deposits.[Deposit Value], Deposits.[Deposit Date], Deposits.Depositor, Info.Tower, Deposits.[Account Number] FROM Info, Deposits Where ([Account Number] = "1234");</p>
  </blockquote>
  
  <p>Now After I run the Line using this command (SQLst is the SQL Line up)</p>
  
  <blockquote>
    <p>DoCmd.OpenQuery SQLst</p>
  </blockquote>
  
  <p>I get this message:</p>
  
  <p><img src="https://i.stack.imgur.com/zrtfi.png" alt="enter image description here"></p>