Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jan 2003
    Location
    Eau Claire, Wisconsin, USA
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Importing Excel into Access (2000)

    I'm importing an Excel file into Access using a macro and it works fine. However, Legare over in the Excel forum showed me code for Excel that would open the file browse window allowing the user to select a file. This seems - to me - to be a much better method than have the path hard-coded in a macro. I'm assuming it's possible to open that same window in Access and allow the user to select the file to import from.

    Here's what I am doing and how can I make it better?

    DoCmd.SetWarnings False
    DoCmd.TransferSpreadsheet acImport, 8, "tblRecruitImport", "civisionRosterImportRosterTool.xls", True, ""
    DoCmd.OpenQuery "qryAppendRecruitDataFromImportTable", acNormal, acEdit
    DoCmd.OpenQuery "qryDeleteRecruitImport", acNormal, acEdit
    DoCmd.SetWarnings True
    DoCmd.OpenForm "frmDone", acNormal, "", "", , acNormal

    I thank you for your time and assistance.

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

    Re: Importing Excel into Access (2000)

    Sadly, Access 2000 doesn't have a built-in File Open dialog you can use in your VBA code. This was only introduced in Access 2002. But, you can use some Windows API calls to show a File Open dialog. See <post#=304810>post 304810</post#>; you can download the zip file attached to that post, unzip the database in the zip file, and import the modules into your database.

  3. #3
    Star Lounger
    Join Date
    Jan 2003
    Location
    Eau Claire, Wisconsin, USA
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Excel into Access (2000)

    Absolutely outstanding! This works great! Thanks, Hans.

Posting Permissions

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