Hi,
Been trying to figure this one out, but am pretty stumped - so any help really appreciated.
I have a dynamically created table with a large number of character & numeric fields. I need to sum the total of all numeric fields & have written the following code:
Been trying to figure this one out, but am pretty stumped - so any help really appreciated.
I have a dynamically created table with a large number of character & numeric fields. I need to sum the total of all numeric fields & have written the following code:
Code:
strx = 'SUM '
FOR i = 1 TO FCOUNT()
IF TYPE(FIELD(i)) = "N"
strx = strx + FIELD(i)
IF i < FCOUNT()
strx = strx + '+'
ENDIF
ENDIF
ENDFOR
strx = strx + " TO total"
&strx[\CODE]
Trouble is that on running it produces an exception code & crashes VFP. Any ideas where I've gone wrong?
TIA