FILL array multi dimensional...

User avatar
sal21
PlatinumLounger
Posts: 4374
Joined: 26 Apr 2010, 17:36

FILL array multi dimensional...

Post by sal21 »

I loop a txt file with the tipical free file, ecc.....

during the loop i fill: var1, var2, var3...varnn

i need to store into a multim dimensional array the value of var.

how to?

note:
i need to erase the array when a IF .. AND IF conition exists ... and make the array free for a new filling of data.

User avatar
HansV
Administrator
Posts: 78642
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: FILL array multi dimesional...

Post by HansV »

Do you know in advance how many variables each line will contain?
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4374
Joined: 26 Apr 2010, 17:36

Re: FILL array multi dimesional...

Post by sal21 »

HansV wrote:Do you know in advance how many variables each line will contain?
19 vars...

naturallly give me the example to lop the filled array :grin: :thankyou:

in this case i need:

for i to array
rs.addnew
....
rs..... first element of array
rs.... second element of array
rs.update

next i

User avatar
HansV
Administrator
Posts: 78642
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: FILL array multi dimensional...

Post by HansV »

Why do you want to use an array? Wouldn't it be easier to populate the fields in the record directly?
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4374
Joined: 26 Apr 2010, 17:36

Re: FILL array multi dimensional...

Post by sal21 »

HansV wrote:Why do you want to use an array? Wouldn't it be easier to populate the fields in the record directly?

particular condition... :smile:

i fill the array with:

..
Dim MARRAY()
...
I = I + 1

ReDim Preserve MARRAY(0 To 18, 0 To I)

MARRAY(0, I) = a
MARRAY(1, I) = b
MARRAY(2, I) = c
MARRAY(3, I) = d
MARRAY(4, I) = e
MARRAY(5, I) = f
MARRAY(6, I) = g
MARRAY(7, I) = h
MARRAY(8, I) = i
MARRAY(9, I) = l
MARRAY(10, I) = m
MARRAY(11, I) = n
MARRAY(12, I) = o
MARRAY(13, I) = p
MARRAY(14, I) = q
MARRAY(15, I) = r
MARRAY(16, I) = s
MARRAY(17, I) = t
MARRAY(18, I) = v

here the loop of array

User avatar
HansV
Administrator
Posts: 78642
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: FILL array multi dimensional...

Post by HansV »

You don't say what "particular condition" is so you haven't answered my question.
Best wishes,
Hans