title: Use variable to enter into table values
body: <p>I am unable to use a variable as the vale for a table, though direct values are stored.
  I get the error as "Syntax error in INSERT INTO Statement.How do I overcome this ?</p>
  
  <pre><code>sDBPAth = App.Path &amp; "\SETMDBPATH.mdb"
  sConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _
                    "Data Source=" &amp; sDBPAth &amp; ";" &amp; _
                   "Jet OLEDB:Engine Type=4;"
                   ' Type=4 to create an Access97 mdb, If omitted Access2000 mdb
  
  ' ------------------------
  ' Create New ADOX Object
  ' ------------------------
   Set oDB = New ADOX.Catalog
   oDB.Create sConStr
  
   Set oCn = New ADODB.Connection
   oCn.ConnectionString = sConStr
   oCn.Open
  
   Set oCM = New ADODB.Command
   oCM.ActiveConnection = oCn
   oCM.CommandText = "CREATE TABLE MDBPATH(" &amp; _
          "MDBPATH TEXT(40)      NOT NULL," &amp; _
          "pass  TEXT(10))"
   oCM.Execute
  
  ' Populate the table.
   oCn.Execute "INSERT INTO MDBPATH VALUES (sDBPAth, 1,)" 'If 'sDBPath' is used the word sDBPath is stored not the variable value
  '
  ' ------------------------
  ' Release / Destroy Objects
  ' ------------------------
   If Not oCM Is Nothing Then Set oCM = Nothing
   If Not oCn Is Nothing Then Set oCn = Nothing
   If Not oDB Is Nothing Then Set oDB = Nothing
  
   End Sub
  </code></pre>