Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)   Spam!  
Old December 30th, 2014, 03:33 PM
dsgdsg
Guest
 
Posts: n/a
Default Very slow Import XLSX file to access MDB

Hello there !
I wrote the following code to import an excel table containing some 25 columns and thousands of records.

The import time is extremely long with a few thousands records ... and since the xlsx files might grow and reach 100.000 records ... it will not be acceptable !

Would you have any better method to access the xlsx records and copy them to the MS-access table ?! Many thanks !!



cfile = xPath + "sales.xlsx"
objExcel.Workbooks.Open cfile
nindex = 1

StatusBar.Panels(1) = "Importing from excel ..."

Do While Not (IsNull(objExcel.Cells(nindex, 1)) Or IsEmpty(objExcel.Cells(nindex, 1)))

T_ECSALES.Recordset.AddNew

For X = 1 To UBound(aFields)
If IsNull(objExcel.Cells(nindex, aFields(X).ColumnNumber + 1)) Or _
IsEmpty(objExcel.Cells(nindex, aFields(X).ColumnNumber + 1)) Or _
Len(Trim(objExcel.Cells(nindex, aFields(X).ColumnNumber + 1))) = 0
Then
T_ECSALES.Recordset(aFields(X).AccessFieldName) = 0
Else
T_ECSALES.Recordset(aFields(X).AccessFieldName) = objExcel.Cells (nindex, aFields(X).ColumnNumber + 1)
End If
Next

T_ECSALES.Recordset.Update

nindex = nindex + 1
ProgressBarSALESImport.Value = nindex

Loop

objExcel.Quit
Set objExcel = Nothing
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Access (.mdb) file from ASP mfarooqw ASP.NET 2.0 Basics 1 June 5th, 2007 02:39 AM
import data from mdb to another mdb mat41 Classic ASP Professional 3 March 9th, 2007 06:01 AM
Open mde or mdb access file from vb6 gorgo Pro VB 6 1 February 20th, 2006 12:39 AM
how to browse and load mdb file from access form method Access 1 June 18th, 2005 09:52 AM
Manage the .ldb file when ADO opens a Access .mdb marcelescu Visual C++ 1 October 18th, 2004 06:44 PM



All times are GMT -4. The time now is 04:39 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.