Results 1 to 6 of 6
  1. #1
    Itch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Posts
    3

    Importing Excel Data Tables into Access

    Hey everyone. Trying to cut my teeth on Access for the first time, from a programming direction and hoping I can find some advice.



    My objective is to find and open an excel file(got that code) and then import the contents of 7 excel Data Tables into the 3 corresponding Access Tables.
    I've been looking at TransferSpreadsheet command but it does not seem to recognize the Excel Tables as a legit named range. I get an runtime error 3011, can't find object. I've checked spelling and a few other things I could think of based off of user error.

    Any suggestions of what I need to chase down?

    -edit
    sorry, forgot to mention a) office 2010 and the line I'm trying is

    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12Xml, conTABLE_NAME, conFILE_PATH, True, conRANGE_NAME

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Are the con... entities getting correctly set? Review link on debug techniques at bottom of my post.

    Show the complete procedure. If you want to provide files for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Itch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Posts
    3

    Thanks for looking.

    Sure.. The code honestly was a scrape from something I had found online.
    Incase it matters, the Q; drive is a network drive.
    I have the Table created in Access w/ the same headers that are the top row of the named range but the access table itself is currently blank.

    Code:
    Sub test2()
    '************* Define Your Own Constants *************
    Const conFILE_PATH As String = "Q:\Quality\Audits\Project Management Maturity Assessment\2012\PMI\WIP_v2 PMMI.xlsm"
    Const conRANGE_NAME As String = "TableNCs"
    Const conTABLE_NAME As String = "Non_Conformance_Report"
    '*****************************************************
     
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12Xml, conTABLE_NAME, conFILE_PATH, True, conRANGE_NAME
    End Sub

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Seem to remember doing a test of import using named range reference and it didn't work, even though what I read says it should. Had to use sheet name with cell referencing:

    "Sheet1!A1:Z2000"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Itch is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Posts
    3
    Well smack me sill, that did it. Thanks for the explanation!

    And makes it totally pointless for what I need. The table's I'll be inputing wont always be the same numbers of rows in excel. But I now know what I need to track down.

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by June7 View Post

    ...Seem to remember doing a test of import using named range reference and it didn't work, even though what I read says it should...
    What, Micro$oft Help giving incorrect information?

    Whoever heard of such?

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 01-09-2012, 05:55 PM
  2. Importing Data from Excel to Access
    By dkatorza in forum Import/Export Data
    Replies: 3
    Last Post: 11-05-2011, 09:17 AM
  3. Replies: 1
    Last Post: 09-07-2011, 01:56 PM
  4. Replies: 2
    Last Post: 04-22-2010, 10:40 AM
  5. iMPORTING DATA FROM EXCEL TO ACCESS
    By Rameez in forum Import/Export Data
    Replies: 7
    Last Post: 06-16-2009, 12:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums