ACC: Cannot Import Spreadsheet If Field Name Begins with Space

Last reviewed: June 4, 1997
Article ID: Q161336
The information in this article applies to:
  • Microsoft Access versions 7.0, 97

SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

When you try to import a Microsoft Excel spreadsheet into a Microsoft Access database, you may receive the following error message:

   An error occurred trying to import file '<File Name>'. The file was not
   imported.

CAUSE

The error occurs if there is a space preceding one or more of the field names in the spreadsheet.

RESOLUTION

You can resolve the error in the following ways:

  • Open the spreadsheet in Microsoft Excel and remove the leading space from the field name.
  • Link the spreadsheet in Microsoft Access instead of importing it.

STATUS

Microsoft has confirmed this to be a problem in Microsoft Access 7.0 and 97. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start Microsoft Excel and create the following spreadsheet. Type a space in front of the word "Cost":

          Item       <space>Cost       Quantity
          a                   25              2
          b                   23              8
    
    

  2. Save the file as C:\My Documents\TestSpace.xls, and then quit Microsoft Excel.

  3. Start Microsoft Access and open the sample database Northwind.mdb.

  4. On the File menu, point to Get External Data, and then click Import.

  5. In the Import dialog box, select Microsoft Excel (*.xls) in the Files Of Type box, and then select TestSpace.xls. Click Import.

  6. Click Next in the first dialog box of the Import Spreadsheet Wizard.

  7. In the "Does the first row specified contain column headings?" dialog box, click "First Row Contains Column Headings," and then click Finish. Note that you receive the error message.

    To resolve the error, open TestSpace.xls in Microsoft Excel and remove the space in front of the word "Cost." Then repeat steps 2-7 and note that the error does not occur.

REFERENCES

For more information about importing data from Microsoft Excel into Microsoft Access, search the Help Index for "Microsoft Excel, importing and linking Excel data," or ask the Microsoft Access 97 Office Assistant.


Additional query words: worksheet attach
Keywords : IsmExl5 kberrmsg kbinterop
Version : 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbbug
Resolution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 4, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.