+ Reply to Thread
Results 1 to 8 of 8

Export data from Excel to Access Database too slow

  1. #1
    Registered User
    Join Date
    08-12-2014
    Location
    Sweden
    MS-Off Ver
    MS Office 10
    Posts
    4

    Export data from Excel to Access Database too slow

    Hi,

    This is my first post and I hope I can get some good feedback.

    I am running a giant for loop with many excel calculations, where the finalized product will be a sheet to export, named ExportSheet. The range in this sheet is only changing with the amount of rows set by "LastRow", but the columns stays the same.

    The export sheet is then set to be exported into an Access Table where it will be stored in the database. My problem is that this export code is taking very long time and I am now looking for ways to improve it. I hope this is within your boundaries even though its including Access and not only Excel. A normal ExportSheet would include a range of 35 x 2500 cells all filled with data. Why I want it to run faster is because its part of a really large for loop. The loop posted below is just an example to show you the logic behind it.

    Dim acc As New Access.Application
    acc.OpenCurrentDatabase "N:\blabla\MarketingCostDataBase.accdb"

    '________________________________________________________
    For x=1 to 10

    acc.DoCmd.TransferSpreadsheet _
    acImport, _
    acSpreadsheetTypeExcel12Xml, _
    ExportID, _
    Application.ActiveWorkbook.FullName, _
    True, _
    "ExportSheet$A3:AH" & LastRow _

    Next x
    '________________________________________________________

    acc.CloseCurrentDatabase
    acc.Quit
    Set acc = Nothing



    So for my questions:
    What way is the fastest to transfer data from Excel to Access?
    Any improvements I can do to my VBA code to make the export process run faster?


    Thank you in advance and let me know if I expressed myself too unclear.

  2. #2
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Export data from Excel to Access Database too slow

    Hi norb,

    an you post the file?
    Remember you are unique, like everyone else

  3. #3
    Registered User
    Join Date
    08-12-2014
    Location
    Sweden
    MS-Off Ver
    MS Office 10
    Posts
    4

    Re: Export data from Excel to Access Database too slow

    Hi noboffinme,

    Sorry I cannot post the complete file as its not working without the input data, which I cannot post here. However, the only code I have including the Access connection and export are mentioned in the post above.

    I hope there is another way around it.

  4. #4
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Export data from Excel to Access Database too slow

    OK, have you stepped through the code to see where it hangs up (takes a long time to process)?

  5. #5
    Registered User
    Join Date
    08-12-2014
    Location
    Sweden
    MS-Off Ver
    MS Office 10
    Posts
    4

    Re: Export data from Excel to Access Database too slow

    Yes I have, it takes a lot of time to transport the range from excel to access. All the calculations before are very quick.

    Regarding the transport, I've also noted that the more data with in the range, the longer it takes (obviously), just that when I reach about the max size of 35 columns and 2500 rows, this exporting takes a long time. Any idea? Maybe it is the Access database that operates more slowly when it stores a lot of data?

    edit: long as in maybe 20 mins for 2500 rows... Which is maybe a bit strange...

  6. #6
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Export data from Excel to Access Database too slow

    What overall size is the Access database in Megabytes (MB)?

    You could do a test by creating a new empty database & export to that & see how long it takes.
    Last edited by noboffinme; 08-12-2014 at 08:52 AM.

  7. #7
    Registered User
    Join Date
    08-12-2014
    Location
    Sweden
    MS-Off Ver
    MS Office 10
    Posts
    4

    Re: Export data from Excel to Access Database too slow

    Before I stopped the calculation, It was 227 MB of data. All in the same Table.
    Keep in mind when I started, the database was empty. I let it run over night and yet it still only managed to export the 226 MB of data...

    Basically I am looping the calculation for every day the past 3 years, and the data per day will gradually become larger. The 226 MB would maybe be 20% of the total Data I want to collect, I just don't have the time for it to loop for a week...

    FYI: When I export a heavy file into a blank database, the calculation goes very fast.

  8. #8
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Export data from Excel to Access Database too slow

    I would try moving your files to the empty database step by step, testing the run each time to see if you can isolate the problem.

    Otherwise, post the file with some dummy data.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need To Export Excel Data To Access Database Daily
    By NFLnut in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-26-2014, 09:33 PM
  2. Replies: 2
    Last Post: 07-05-2013, 09:37 AM
  3. Export Email Info to Access Database
    By pr4t3ek in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 04-23-2009, 07:49 AM
  4. Export data from Excel to Access Database
    By drpkrupa in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-06-2008, 05:52 PM
  5. [SOLVED] Export data into Access Database
    By Noemi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-27-2006, 03:25 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1