Automating Importing

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.
 
G

Guest

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.
 
S

simon

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top