Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RUN TIME 2391 FIELD F1 DOESN'T EXIST - FILE IMPORT

Status
Not open for further replies.

LBERNARDE

Programmer
Mar 14, 2001
21
US
I'm trying to use the following code to import a file into a table. However, I'm getting the error "Run-Time Error 2391" Field F1 doesn't exist in destination table. However, when I go file, get external data, import I can successfully impor the file. Not sure why I can't do it in code. Any suggestions?
Thanks Lisa

varFileName = "c:\windows\desktop\download files to import\barnstead\abl92502l.XLS"

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel5, "tblISCLeadsABLALN", varFileName
 
An educated guess would be that your varFilename variable consisting of a full path has a blank space. When that happens, unless you place the entire full path in quotes, it will not be able to find the file. Your varFilename variable would even look consistent in the debugger but DoCmd.TransferSpreadsheet can't handle it. I've fixed this problem in my own code a number of times.
----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
 
I am having the same error. It appears to me that in the original post on this thread that the user did put his full path (which included spaces) in quotes and he still got the error, so SCKING's post is not clear to me.

Here is my code that's throwing the error:
Code:
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Rolodex", "Y:\Databases\rolodex.xls", False

I am using MS Access & Excel 2000.

Also, how do I "map" fields if they aren't in the same order?

 
I can get transferdatabase to work ok on my dbf's but I can't get transferspreadsheet to work on my xls's...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top