title: can't call update query from Excel VBA
body: <p>I have a stored query in an Access 2007 database.  I have Access 2010 on this machine.  I am trying to do the following:</p>
  
  <ol>
  <li>export an Excel spreadsheet as a temp table in the database.</li>
  <li>add a column to the temp table and populate it with the filename</li>
  <li>update a linked table using the contents of the exported table.</li>
  </ol>
  
  <p>The update is a stored query in the Access front end.  When I run the update query from Access, it works fine.  But when I run it from VBA using the code:</p>
  
  <pre><code>sub test()
  
  filename=thisworkbook.name
  Set db_fe = OpenDatabase("C:\Data\myDB.mdb")
  If TableExists(db_fe, "tempCorrection") Then
      DoCmd.RunSQL "drop table tempCorrection;"
  End If
  DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12Xml, "tempCorrection", "C:\Data\corrections.xls", True
  
  
  DoCmd.RunSQL "alter table tempCorrection add column newColumn text;"
  DoCmd.RunSQL "update tempCorrection set newColumn='" &amp; filename &amp; "';", dbFailOnError
  db_fe.Execute "updateCorrections", dbFailOnError
  DoCmd.RunSQL "drop table tempCorrection;"
  
  end sub
  </code></pre>
  
  <p>then on the "db_fe.execute" line I get Run-time error '3078': "The Microsoft Access database engine cannot find the input table or query 'tempCorrection'.  Make sure it exists and that its name is spelled correctly."</p>
  
  <p>Here's what query updateCorrections looks like:</p>
  
  <pre><code>UPDATE production AS p
  INNER JOIN tempCorrection AS t
  ON
  (p.filename=t.filename)
  AND
  (p.a1=t.a1)
  AND
  (p.a2=t.a2)
  set p.a3=t.a3
  </code></pre>
  
  <p>Any ideas as to why I'm having trouble executing this query from VBA?</p>