Results 1 to 4 of 4

Thread: Import Excel SpreadSheet Into Access Table

  1. #1
    Join Date
    Dec 2009
    Posts
    79

    Import Excel SpreadSheet Into Access Table

    I thought this was going to be easy....I'm doing
    Code:
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9,  _
    "Temp_PercentRank_EBC_Adult", _
    "d:\PercentRank.xls", True, _
    "EBC_Adult!A6:J2130"
    Temp_PercentRank_EBC_Adult" is an Access Table with 10 fields.

    d:\PercentRank.xls is an Excel Spreadsheet with 10 columns (A through J).

    When I run the TransferSpreadsheet line, I get the following error:
    Quote Originally Posted by Import Error
    Run-time error '2391'

    Field '18' doesn't exist in the destination table
    'Temp_PercentRank_EBC_Adult'
    This makes sense to me...there is no Field '18' - so, what is it really trying to tell me?

    (EBC_Adult is the name of a worksheet within the workbook d:\PercentRank.xls)
    Last edited by Moe1950; 03-19-2012 at 08:56 AM.

  2. #2
    Join Date
    May 2006
    Posts
    407
    Is Access looking for the names of your fields to be in the first row of your data? I believe that would be row 6. What are the values of the 10 columns of your data, starting at column A? I'm thinking one of those values will be 18, and very possibly it will be in the first column.

  3. #3
    Join Date
    Dec 2009
    Posts
    79
    That was a very good "thinking"....when I put my column headers on Row1 both Access and Excel seemed to know what to do.

    While working on this I discovered that I could manually import the file, save the import steps, and then reuse them with a
    Code:
    DoCmd.RunSavedImportExport "NameOfSavedImport"
    which I thought was way cool, so thats what I am using instead of the TransferSpreadsheet.

  4. #4
    Join Date
    May 2006
    Posts
    407
    Glad you got it working.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •