I am trying to impot a excel file and replace with existing table in database.
Every time it import a extra automated field(F1),so it gives the error message:
"Field'F1' doesnot exost in destination table'table name'"
How can i impot my excel file into existing table,whose field names are same?And without autonum field?
The code i craft is:
Thankful for helping always!
Every time it import a extra automated field(F1),so it gives the error message:
"Field'F1' doesnot exost in destination table'table name'"
How can i impot my excel file into existing table,whose field names are same?And without autonum field?
The code i craft is:
Code:
Private Sub cmdImport_click() Dim msg As String Dim button As Variant Dim title As String Dim response As Variant msg = "Is the updated file Task Import placed in File path with 'file name.xls'?" button = vbYesNo + vbDefaultButton2 title = "File Location Checkpoint" response = MsgBox(msg, button, title) If response = vbYes Then 'Delete old records from tbltask DoCmd.SetWarnings False DoCmd.RunSQL "Delete [dbaseTable name].* from [dbaseTable name]" DoCmd.SetWarnings True 'Import new records from Excel file into tblTask DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "dbaseTable name", "File path with 'file name.xls'" DoCmd.OpenForm "Form1" End If End sub
Comment