PDA

View Full Version : Declaring Array -Urgent


buddu
06-19-02, 08:47
HI to All
I got irretation to work with arrays.
Because While running the folling code I got the Error message Subscript OutOfRange. How do I solve this?

Dim MyArr()
For I=1 to 5
ReDim Preserve MyArr(I,2)
MyArr(I,0)="No"
MyArr(I,1)="Name"
MyArr(I,2)="Amount"
Next




Please Help me

rnealejr
06-20-02, 00:41
You can only use preserve when you are changing the last dimension - not the first. What are you trying to accomplish ?

buddu
06-20-02, 02:07
Hi
I have a routine like calulating the State,City,county,Other Taxes. It has some calculation with some other Fields.
Once the Calculation has finished I need to Insert the Records In Mytable Like // AutoNum, AcNo,State,City,County,Other //. In this case
if i insert in forLoop every state,city.... will insert diff rows Like

AutoNo,Acno,State,0,0,0

But I need the Row to Insert All Taxes.

Because of this I am just trying to insert into Array and then inserting.

rnealejr
06-20-02, 11:58
I would use a programmatically created recordset and not an array. This is a recordset that is not tied to a database but rather fields you create dynamically and can manipulate like a recordset. It also gives you many more options to handle the data since methods already exist.

Let me know if you need further assistance.

Good luck.