Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  Spam!  
Old December 30th, 2014, 04: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




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 07:01 AM
Open mde or mdb access file from vb6 gorgo Pro VB 6 1 February 20th, 2006 01: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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.