Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004

    Exclamation Unanswered: code to import xls files (urgent!!!!)

    Im currently working at a job attachment at CTO and the supervisor just came up to me saying she wants this in under 2 hours.
    So is there anyone out there that can help me with code to import xls files into access? i know access has a built in function for it but what she wants done is to make a switchboard with a command button that:

    1. imports a selected xls file
    2. appends the file to the main table
    3. ensures the field names are the same as the main table

    thnx guys i wuld really appreciate this help...sorry bout the post before i cant seem to delete it

  2. #2
    Join Date
    Feb 2004

    I would be wary about importing excel files, I have done this in VB using the excel object library and it had serious problems if there were more than 32,767 rows (which is an integer if I am not mistaken).
    Common practise is to save the Excel file as a comma delimited file and then import the comma delimited file.

    If you still really need to import using excel, then you need to research:
    Microsft Excel 8.0 Object Library .DLL
    You can make a reference to it in Tools/References (you need to be in a code module first).


  3. #3
    Join Date
    Oct 2003
    Provided Answers: 1
    Try this
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97, urExistingTable2StoreDataIn, "C:\Temp\urXLfileName.xls", True

    This should import the data into the given table name. If u run it twice, it should apend the data into the given table.

Posting Permissions

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