Run Time Error '2391.' Field "F1" not in destination table?

G

Guest

I'm in a VBA module in Excel trying to get a table in Access and transfer
data to an excel spreadsheet. I'm using the following commands:
Set accapp =
GetObject("O:\STAFFHQ\SYMDATA\Actuarial\Databases\Reserving\Reserving
Database.mdb", "Access.Application")
accapp.DoCmd.TransferSpreadsheet acExport, 8, "tjunk", exceldirectory, True,
""
I'm getting the following error message.
Run Time Error '2391':
Field 'F1' doesn't exist in destination table 'tjunk.'
Anyone know what this means? Thanks!
 
J

John Nurick

Hi Arch,

What value does
acExport
have in this context? The fact that the error referring to tjunk as the
destination table makes me wonder whether perhaps you don't have a
reference to the Access library and haven't declared Option Explicit. In
that case
acExport
would return 0, which is the value of acImport.

Also, does
exceldirectory
contain the name of a folder or of an .xls file? Is there a reason for
passing an empty string as the Range argument (normally one would just
omit the optional argument)?

If you haven't already done so, check out these articles on using Access
as an automation server
http://support.microsoft.com/?id=147816
http://support.microsoft.com/?id=210111
and consider (instead of using automating Access) using the DAO or ADO
libraries to execute SQL query that exports the table to a workbook.
 
S

Steve Ripley via AccessMonster.com

Field "F1" is the default name for first column or "A" of the spreadsheet
if you are doing an import of a spreadsheet where the first row does not
contain the column names.

With out seeing the definition of the table or spreadsheet, that's as good
as it gets.
 

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