>>>>If I'm running this code, the result is incorrect, because VFP cannot handle that large numbers.
>>>>What would be a workaround?
>>>>
>>>>CREATE CURSOR cuTest (test c(20))
>>>>FOR lnNr = 1 TO 7000
>>>> INSERT INTO cutest VALUES ("123456789012345")
>>>>endfor
>>>>SUM VAL(test) TO lntest
>>>>
>>>
>>>
>>>Does this work?
>>>
>>>
SELECT CAST(VAL(test) AS Currency) AS nBigNumber ;
>>> FROM cuTest ;
>>> INTO CURSOR c_temp
>>>
>>>SUM nBigNunber TO lnTest
>>>
>>>* Or, use a direct SUM() in the SQL SELECT.
>>
>>It gives an error "Currency value out of range".
>
>
>I hadn't seen the solution post, but try Double.
Double does not give an error, but it gives the same wrong calculation as a direct SUM.
Good to know, it's an issue when you have to add bank account numbers to create a checksum for the bank files for instance.
Christian Isberner
Software Consultant