Solved

Transfer data from excel to Acess using access VBA

Posted on 2014-02-03
4
1,654 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 29

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
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…

762 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