Solved

Transfer data from excel to Acess using access VBA

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

Expert Comment

by:gowflow
Comment Utility
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 24

Accepted Solution

by:
chaau earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
This is what seems to be woring the best
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now