Public Sub I005_ImportExcelToAccess(strExcelFile As String, _
strTableName As String)
Dim strTable
strTable = "TempTable"
Call q715_DeleteFrom_Table(strTableName)
DoCmd.TransferSpreadsheet _
TransferType:=acImport, _
TableName:=strTable, _
FileName:=strExcelFile, _
HasFieldNames:=True
'append the imported records
CurrentDb.Execute "insert into Tbl_Temp select * from [" & strTable & "]"
'drop the tempTable
CurrentDb.Execute "drop table [" & strTable & "]"
End Sub
|