473,503 Members | 2,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inserting an Array of Data into an Access Table

119 New Member
I have a large array of data (1000 x 40 x 3) that I am inserting into a database table. It is incredibly slow, and so I was wondering if there is a quicker way of inserting array data into a table.

Here is the code I am currently using:

Expand|Select|Wrap|Line Numbers
  1.     ' [Date],[Security],[Field]
  2.     With rs
  3.         For nSec = 0 To UBound(vtData, 2)
  4.             For ndate = 0 To UBound(vtData, 1)
  5.                 For nfield = 1 To UBound(vtData, 3)
  6.                     If IsNumeric(vtData(ndate, nSec, nfield)) Then
  7.                         ' Add to results table
  8.                         .AddNew
  9.                         !Security = vtSec(nSec)
  10.                         !Date = vtData(ndate, nSec, 0)
  11.                         !FieldName = vtFields(nfield - 1)
  12.                         !FieldData = vtData(ndate, nSec, nfield)
  13.                         .Update
  14.                     End If
  15.                 Next
  16.             Next
  17.         Next
  18.     End With
  19.  
Jan 20 '09 #1
5 10031
ChipR
1,287 Recognized Expert Top Contributor
It may help to surround the whole process with
Access.Application.DBEngine.BeginTrans
and
Access.Application.DBEngine.CommitTrans
Jan 20 '09 #2
billelev
119 New Member
That seems to have helped a lot - thanks.

As an aside - is looping through the array the only/best way of inserting data into a table?
Jan 21 '09 #3
ChipR
1,287 Recognized Expert Top Contributor
I haven't found any alternative in vba, or vb for that matter.
Jan 21 '09 #4
NeoPa
32,557 Recognized Expert Moderator MVP
Like Chip, I'm not aware of any alternative way of importing data from an array.

How did the data arrive in the first place though? It may be that the data can better be imported from there.
Jan 28 '09 #5
billelev
119 New Member
The data arrives in an array. Thanks for all your input.
Jan 28 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6832
by: Joachim Klassen | last post by:
Hi all, first apologies if this question looks the same as another one I recently posted - its a different thing but for the same szenario:-). We are having performance problems when...
0
1561
by: Alistair | last post by:
Hi all, I am creating a database based site that keeps track of books, who has read them and the comments they have. After a little help in M.P.I.asp.DB I managed to create a database (access...
15
2881
by: Jaraba | last post by:
I am working in a project that I need to parse an arrayt an select records based upon the values parsed. I used the functions developed by Knut Stolze in his article 'Parsing Strings'. I am...
0
2610
by: freeskier | last post by:
Hello, Sorry for the newb question; I've spent a good amount of time trying to figure this out. I am fairly new to the Postgre world. I am currently in the process of upsizing several MS Access...
6
11745
by: ashes | last post by:
Hi, I am creating an ecommerce website using Microsoft Visual Studio, VB.Net and MS Access 2003. I am new to VB.Net When someone wants to register on the website, they fill out a form and the...
2
3057
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
2
3094
by: hakkatil | last post by:
Hi to all, I have a page that inserts excel sheet to access database. I am using asp. What I want to do is to check the inserting record if it is in the database. Basicly checking the dublicate...
2
2613
by: cluce | last post by:
I am trying to read a csv file with user info (username, password, email, address, city, zip, state, etc.) I am inserting the username, password, email into the aspnet_memberhsip table using the...
5
2143
by: rando1000 | last post by:
Okay, here's my situation. I need to loop through a file, inserting records based on a number field (in order) and if the character in a certain field = "##", I need to insert a blank record. ...
0
7204
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7342
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7464
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5586
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4680
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.