Importing Data with Update Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Please help.

This below is my current import code for linking an excel spreadsheet into a
table and running an append query. I am looking to get rid of the append
query and write as an sql in the import code an update query that will update
from another table into my temp table.
Private Sub cmdLoadData_Click()
strPath = "\\w2k6001\data\NCHO\Housing Services\Data Warehouse\Weekly
CSAT Report\"
strFileName = Dir(strPath & "NPSReport.xls")
strTempTable = "tblAddressTemp"
MsgBox "Data Loading...", vbInformation
If Len(strFileName) <> 0 Then
DoCmd.TransferSpreadsheet acLink, , strTempTable, strPath &
strFileName, True
CurrentDb.Execute ("qappAddress"), dbFailOnError
DoCmd.DeleteObject acTable, strTempTable
End If
MsgBox "Import Complete", vbInformation
End Sub

Thanks,
Jez
 
Stored queries execute faster than in line queries. It would actually be
better to create your update query and use it just as you are the append
query. If, however, you want to use VBA, it would be something like:

CurrentDb.Execute("your sql code here"), dbFailOnError
 
Back
Top