Automating Importing

  • Thread starter Thread starter simon
  • Start date Start date
S

simon

I have a table set up called Rebates, I have created a piece of VBA
which will find a file using an explorer window and then was hoping to
use TransferSpreadsheet to import a file in with this:

Sub ImportXLS()

FileName = FindFile("C:\", "Select File To Upload", "Upload Files",
"*.xls")

DoCmd.TransferSpreadsheet acImport, , "Rebates", FileName, True

End Sub


The thing is, when I try and import to the table Rebates, I get this
error:

Run-time error '2391':

Field 'F5' doesn't exist in destination table 'Rebates.'

Can anyone help me load this? The first line of the file contains the
column headings and was used to build the table 'Rebates'. It will be
the same format loaded to this table each month.
 
There is a column in the spreadsheet that Access thinks has data in it and
since it doesn't have a column header, it is assigning the name F5 as a field
name. That field does not exist in the Rebates table.

You need to find out why there is data in that column.
 
Managed to sort it in the end, issue with field set up on access and
the formatting on the columns on the spreadsheets that were being
imported.
 
Back
Top