I am having trouble getting the following code to load data from my Excel file "Book.xlsx" into my table called "ExcelDataBook":
Sub btnExcelImport_Click()
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "ExcelDataBook", _
"C:\Users\dacampb1\Desktop\Book.xlsx", , "Sheet1!A1:B12000"
End Sub
The Excel file only has one sheet "Sheet1' and has only 10,504 rows but this can vary so I set it in the code for 12,000 rows. The sheet has only two columns "A" and "B" with the first row of the two columns labeled "Store" and "Amount" and my tabel has only two fields "Store" and "Amount".
My error reads:
Run-time error '2391': Field 'F1' doesn't exist in the destination table 'ExcelDataBook.'