Insert Excel sheet content into Access table from
The subject just about explains my goal. From an access form, a button launches the following...
firstpath = "C:\class\orders.xls"
Dim XL As Excel.Application
Dim XLBook As Excel.Workbook
Dim XLSheet As Excel.Worksheet
Set XL = CreateObject("Excel.Application")
Set XLBook = GetObject(firstpathj)
Set XLSheet = XLBook.Worksheets(1)
DoCMD.RunSQL "INSERT INTO TABLE1 (VAR1, VAR1, ....)" & _
"SELECT XLSheet.Cells(1,1), XLSheet.Cells(1,2) from XLSheet"
I get the error
"MS Jet database engine could not find the input table or query XLSheet."
Does anyone know how to identify to access that xlsheet is the data source?
Thanks.
|