title: SQl Query in VBA Access: Workaround for quotation mark contained in object name
body: <p>I am using VBA in Microsoft Access and trying to define a recordset using the following SQL query in my VBA code.</p>
  
  <pre><code>Set rs1 = db.OpenRecordset("SELECT DISTINCT food, compound FROM Composition_data", dbOpenDynaset, dbReadOnly)
  Set rs6 = db.OpenRecordset("SELECT [ID] FROM Compounds WHERE Compounds.Name = """ &amp; rs1("compound") &amp; """", dbOpenDynaset, dbReadOnly)
  </code></pre>
  
  <p>I am having trouble with defining <code>rs6</code>. My issue is not the query itself, but with <code>rs1("compound")</code>. The compound names unfortunately contain quotation marks which disrupt the query statement in VBA. This derives from chemical nomenclature and cannot be changed.</p>
  
  <p>Any ideas how to workaround this? I've tried both () and [] brackets in various constellations, but they do not override the " contained in the compound name.</p>