title: Can't use a variable as column name in VBA Excel query with Access db
body: <pre class="lang-vb prettyprint-override"><code>Dim SQLStr As String
  
  SQLStr = &quot;UPDATE amenities SET [Accessible Parking On Site]='&quot; &amp; newName &amp; _
              &quot;' WHERE HostelKey='&quot; &amp; hostel &amp; &quot;';&quot;
  </code></pre>
  <p>This query updates the access database in the right field.
  My problem is that I can't get it to work with the field <code>[Accessible Parking On Site]</code> being a variable. (<code>newName</code> and <code>hostel</code> are variables, I am  using <code>[]</code> around the field name because some field names in the table have spaces).</p>