title: vba access append multiple tables into one
body: <p>First off I'm a novice at programming.</p>
  
  <p>Question I have built the code below from many examples off the internet.
  The database is named "Code Holder" at this time I have a table "test" and into that table I want append as many tables as there are in the database.</p>
  
  <ol>
  <li>All columns will be the same for all tables</li>
  <li>The table names other than "Test" will change</li>
  </ol>
  
  <p>What I have so far is below,
  The code runs fine, but I can't seem to get each table to append into the "Test" table, each table comes up blank in the SQL string</p>
  
  <pre><code>Sub append4()
      Dim db As Database
      Dim tdf As TableDef
      Dim rs As Recordset         
      Set db = currentdb()
      Set rs = db.OpenRecordset("test")
  
      For Each tdf In db.TableDefs
                  StrSQL = "INSERT INTO " &amp; "test" &amp; " " &amp; _
                  "SELECT * " &amp; _
                  "FROM " &amp; "rs!tablename" &amp; " ;"
              DoCmd.RunSQL StrSQL
          Next tdf
  
      Set db = Nothing
  
  End Sub
  </code></pre>
  
  <p>I want to say that I haven't set rs. correctly but I'm not certain.
  Any help would be appreciated.</p>
  
  <p>Thanks</p>