Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arrays and If..Then..Else?

Status
Not open for further replies.

deepsheep

Programmer
Sep 13, 2002
154
CA
I have a strange problem. I cannot manage to update values in certain arrays, but only in an if statement.
For example:

if state=1 then
array1[1]:=array1[1]+newvalue
else
array2[1]:=array2[1]+newvalue;


Array1 does not work; it will always be 0. When I copy-paste the code outside the 'if' it works, so I know it is correct. When I try to change the if statement so it is opposite, (switch the if and else criteria) the same array (array1) doesn't work.

Any Suggestions?
 
if state=1 then
array1[1]:=array1[1]+newvalue
else
array2[1]:=array2[1]+newvalue;


well this is too general....I am betting the farm that this is not your problem formula.

What is "state" is it a field, a variable, a formula...what?

Can Whatever it is ever be NULL.

Are Array1 and Array2 the same datatype?...they should be
Are they strings?? What is NewValue??

Post the whole story.....the complete formula not just what you think is the problem....this formula as it stands is fine....there are other problems that you have to address....but we cannot guess what they are...

Jim Broadbent
 
It really is that simple. They are all numbervar and cannot be null. Something I did made it magically work, but I haven't a clue what.

You don't need to be rude about it.
 
well there was nothing wrong in the first place then since the formula was fine...we cannot solve magic problems

Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top