ACC: TransferSpreadsheet May Not Allow Table AppendID: Q153812
|
Moderate: Requires basic macro, coding, and interoperability skills.
When you append data from a spreadsheet to an existing table by using a
TransferSpreadsheet macro action or a TransferSpreadsheet method in Visual
Basic for Applications, you may receive the following error message:
Field 'F1' doesn't exist in destination table '<table>'. Microsoft Access was unable to append it.
The destination table must contain the same fields as the table you are pasting from.
The first row of the spreadsheet file does not contain field names; therefore, Microsoft Access assumes the fields are named "F1," "F2," and so on.
You can use one of the following two methods to work around this behavior. You can import the spreadsheet into a new table, and then append that data in Microsoft Access; or you can change the spreadsheet to include field names in the first row.
Transfer Type: Import
Spreadsheet Type: <your type>
Table Name: <table in your database>
File Name: <name of file, including path>
Has Field Names: Yes
DoCmd.TransferSpreadsheet acImport, _
<number of type of file to import>, "<table in your database>", _
"<name of file including path>", True
9 Express 800-123-4567
10 US Mail 800-569-4568
Transfer Type: Import
Spreadsheet Type: Microsoft Excel 5-7
Table Name: Shippers
File Name: c:\test1.xls
Has Field Names: No
Function ImportTest()
DoCmd.TransferSpreadsheet acImport, 5, "Shippers", " c:\test1.xls", _
False
End Function
For more information about unexpected behavior with TransferSpreadsheet,
see the following article in the Microsoft Knowledge Base:
Q147785 ACC: Imported MS Excel Spreadsheet May Have Blank Columns
Keywords : kb3rdparty kberrmsg kbinterop IsmSetup
Version : 2.0 7.0 97
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: April 22, 1999