title: How to pass variables from VBA through SQL?
body: <p>I'm trying to pass values from a Form into my database, via SQL:</p>
  
  <pre><code>Private Sub Befehl4_Click()
  
  Dim SQL As String
  Dim unique As String
  
  unique = Forms!frm_test!PN
  
  SQL = "INSERT INTO tab_test (Feld1) VALUES (unique)"
  DoCmd.RunSQL SQL
  
  End Sub
  </code></pre>
  
  <p>When I execute this code from my button in my Form, <code>unique</code> isn't passed to the SQL-command. I have to type it in. When writing the SQL-command this way: </p>
  
  <pre><code>SQL = "INSERT INTO tab_test (Feld1) VALUES (Forms!frm_test!PN)"
  </code></pre>
  
  <p>It works how expected.</p>
  
  <p>What am I missing or doing wrong?</p>