title: Use a variable to name a table I am making
body: <p>I am using VBA macro to make a table. First, I am inputting a date "PeriodEnd", this date filters a base table using a query. Then, I am making a second table and populating that table with (a) the results of the query, and (b) about 30 calculated fields based on the records of the query and other related tables. </p>
  
  <p>My problem is that I am trying to put the PeriodEnd date in the table name and I can't seem to get the Syntax right. I am a VBA beginner, so thanks for the help. My VBA looks like as follows: </p>
  
  <pre><code>....
  Dim db as DAO.Database
  Dim PeriodEnd as Date
  Dim PerStr as String
  
  Set db = CurrentDb()
  PeriodEnd = #12/31/2013#
  PerStr = Format(PeriodEnd, "yyyy-mm-dd")
  
  db.Execute "CREATE TABLE TblName_" &amp; PerStr _
  &amp; " (Field1 as LONG)
  </code></pre>
  
  <p>I've run this with syntax where the table name is static and I don't get any errors. When I run with the variable table name I get "Run-time error '3290': Syntax error in CREATE TABLE statement." </p>
  
  <p>Also, is there a better way to structure this? The only difference in these table will be the period end date--and the impact that a different period end date has on the underlying calculations I am forming in the VBA (functions not supported within the SQL). </p>
  
  <p>Any advice on whether this should be structured instead as a query or a report (no experience yet with reports)?</p>