Quote:
Originally Posted by Stewart Ross Inverness
Hi Wassim. It's not DSum that returns the string - it's the Nz function. You can convert each Nz string value back to a number using one of the type conversion functions as necessary:
- CCur(Nz(DSum..., 0)) ' convert to currency value
-
CDbl(Nz(DSum..., 0)) ' convert to double-precision floating point
-
CLng(Nz(DSum..., 0)) ' convert to long integer
or you can use the Val function to take the numeric value of each string instead
However, as Linq has pointed out you should ensure that the type of the variables or fields you are assigning these values to is correct. Access normally does type conversion 'on the fly' - if the result is assigned to a double-precision value, say, then Access would convert the Nz results to floating-point numbers before performing the sum. It suggests you have a text result type somewhere.
-Stewart
Thank you for your reply. I used the VAL () function and it is converting the string to number.
but I didn't understand why it is replying me a string since i used the dsum function without the NZ () function also the dsum function is doing the sum of fields that datatypes are double.
regards,