Solved

Transfer data from excel to Acess using access VBA

Posted on 2014-02-03
4
1,691 Views
Last Modified: 2014-02-05
What do you think is the most eficient way to export data from excel into access.
We have very large excel file with about 0.5 Millions records , I need to transfer it into access table.

I have a way to do it, but it is VERY slow.  I did a procedure where i first do a linktable to excel file and then i run append query. It take very long time to run. Any other more efficient way to do it?
0
Comment
Question by:maximyshka
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 30

Expert Comment

by:gowflow
ID: 39830828
It can be done the other way around have a macro in VB that export data to the access table however this need to be tested as do not know the time frame of execution when it comes to 05 million record. How many fields you have there ?
gowflow
0
 
LVL 25

Accepted Solution

by:
chaau earned 500 total points
ID: 39830830
I think DoCmd.TransferSpreadsheet should be the fastest:
Dim strXls As String
strXls = "c:\Temp\temp.xls"
DoCmd.TransferSpreadsheet acImport, , "tblExcel", strXls, True, "temp!"

Open in new window

After the import data will be in the table called "tblExcel". You can then run your Append query. Alternatively, you can call DoCmd.TransferSpreadsheet to import directly into your existing table
0
 
LVL 45

Expert Comment

by:aikimark
ID: 39831633
it is VERY slow

1. What actual times are you observing?
2. How big is the Excel workbook?
3. How big is the Excel worksheet?
4. Have you compacted your database recently?
5. How much free RAM (physical memory) do you have when you do the import?
6. Are you importing to an empty table or appending to an existing table?
7. Does the Access table have any indexes?
8. What does your Append query look like?
9. What does your VBA code look like?
10. Are the workbook and database on your local hard drive?
0
 

Author Closing Comment

by:maximyshka
ID: 39835802
This is what seems to be woring the best
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question