Results 1 to 7 of 7
  1. #1
    Breezer23 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    10

    Pulling Excel Table into Access via VBScripting

    I'm trying to pull in a table from Excel into Access but am running into a ton of data type errors. The dates, which are formatted as dates in Excel, just transfer over as text, etc. Is there a way to simplify this proccess and ensure data is transferred accurately?

    The code I'm using as as simple as the following:
    Code:
    Sub test()
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "TABLE NAME", "FILE LOCATION\FILENAME.xls", True
    End Sub
    Better yet, if it would only import whatever rows whose first column entry was contained the word 'Final' would be even more ideal.

    Any help would be great.
    Regards,


    Travis

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,738
    Use google youtube import excel into access

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    Are you importing into an existing table?
    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.

  4. #4
    Breezer23 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    10
    Quote Originally Posted by June7 View Post
    Are you importing into an existing table?
    Ideally, yes, however, if it's easier not to, it can be within its' own table where I can run an append query from it to the main table.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    Test that and see what happens. I have seen cases where Excel and Access didn't communicate nicely about importing date values. If you still have issues, post your Excel file for testing.
    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.

  6. #6
    Breezer23 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    10
    Quote Originally Posted by June7 View Post
    Test that and see what happens. I have seen cases where Excel and Access didn't communicate nicely about importing date values. If you still have issues, post your Excel file for testing.
    Unfortunately, the information included in the database is confidential so I can't share it - unfortunately. It's mildly annoying how Access assumes Data Types based. For example, I have a cell that includes summaries however, not all the historical data has a summary for it so the first 500 entires are blank. Because of this, Access just assumes it's a number field so the other 500 entries that do have a summary are imported incorrectly. This was resolved by sorting the Excel table differently but that is just a work around. This forum has been an incredible resource to help build my understanding of Access so I can't think you all enough.

    A bit of information - The first column in the Excel table is a status. It can be either In Progress or Final. If that first column is Final, I would want the Access script to pull a set of 38 other fields/columns out for that row/line item. There are approximately 75 fields in total (yes I know - insane..) so I would assume the code would be rather long.

    I will play around with what you mentioned, though I'm not entirely sure where to start, I will give it a try!
    Regards,
    Travis

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    What's confidential - name, address, phone, SSN, email - delete or replace with dummy values.
    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.

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

Similar Threads

  1. Replies: 4
    Last Post: 12-17-2012, 01:21 PM
  2. Replies: 3
    Last Post: 12-07-2012, 04:26 PM
  3. Pulling Excel Cell Information via Dynamic URL
    By brenthardy in forum Programming
    Replies: 1
    Last Post: 01-11-2012, 07:16 PM
  4. Replies: 3
    Last Post: 12-21-2010, 11:52 AM
  5. Pulling Specific Data from Excel
    By DICKBUTTONS in forum Access
    Replies: 1
    Last Post: 11-19-2010, 11:23 AM

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