ACC: Can't Import Numeric Field Names with TransferSpreadsheetLast reviewed: April 1, 1997Article ID: Q165142 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. When you use the TransferSpreadsheet macro action or Visual Basic method to import a Microsoft Excel spreadsheet that contains numeric field names, the fields in the new table are named F1, F2, F3, and so on.
RESOLUTIONThere are two ways you can work around this behavior.
Method 1: Change Field Names in Microsoft ExcelIf you want to use TransferSpreadsheet to import a Microsoft Excel file that contains field names, you must change the field names in Microsoft Excel so they are non-numeric. It is not enough to format the cells as text in Microsoft Excel, but leave the numeric values. You must change the field names or precede the numbers with one or more non-numeric characters, such as a letter of the alphabet or an underscore (_). NOTE: You cannot use a space as the first character of the field name. If you format the field name as Text in Microsoft Excel, and then you use a space as the first character of the field name in an attempt to preserve its numeric name, you receive the following error message when you try to import the file:
The database engine can't find '<Field Name>'. Make sure it is a valid parameter or alias name, that it doesn't include invalid characters or punctuation, and that the name isn't too long. Method 2: Use the Import Spreadsheet Wizard
MORE INFORMATION
Steps to Reproduce BehaviorThe following example uses the TransferSpreadsheet action in a macro. You can also reproduce this behavior if you use the TransferSpreadsheet method of the DoCmd object in Visual Basic code.
REFERENCESFor more information about using TransferSpreadsheet in a macro or in code, search the Help Index for "TransferSpreadsheet action" or "TransferSpreadsheet method."
|
Additional query words: fieldname
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |