Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Import data from Excel (Access 2003 SP2)

    I extract data from spreadsheets each week into an Access database. The spreadsheets are supposed to have the same layout of 10 columns. The Access table the data is imported into provides for 30 columns because occasionally, even when only 10 columns appear to have data and Ctrl+End takes you to a cell in the 10th column, Access somehow recognizes more columns and gives me error 2391, field F31 does not exist in the destination table.

    What is the syntax for adding a range to the import code? I can't seem to get it right.
    DoCmd.TransferSpreadsheet acImport, , "impFileData", strFileName, False
    Thanks
    chuck

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Import data from Excel (Access 2003 SP2)

    You can specify the Range argument as a string, e.g.

    DoCmd.TransferSpreadsheet acImport, , "impFileData", strFileName, False, "A1:J10"

    or

    DoCmd.TransferSpreadsheet acImport, , "impFileData", strFileName, False, "Sheet3!A1:J10"

  3. #3
    3 Star Lounger
    Join Date
    Mar 2006
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    289
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Import data from Excel (Access 2003 SP2)

    I found it in the help file...daaa.
    Thanks
    chuck

Posting Permissions

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