Sum 2 expressions

MartynE

Registered User.
Local time
Today, 13:50
Joined
Mar 27, 2013
Messages
49
I'm trying to sum up 2 expressions.

1st. UsedAF: nz(DSum("AF_lengte+AF_zaagbreedte";"VRMUTSTAF";"VRID = " & [VR].[VRID]);0)
2nd. UsedRES: nz(DSum("RES_lengte+RES_zaagbreedte";"VRRESSTAF";"VRID = " & [VR].[VRID]);0)

Now with a third expression I like to sum those 2 up.

3rd. Used: [UsedRES]+[UsedAF]

The thing I run into is when 1st has a value of 15 and 2nd a value of 0 the outcome of 3rd is 150 while it should be 15 ofcourse.

When I change the first 2 expressions to Sum (at Totals) the 3rd works properly. Yet the other 2 comes with wrong values.

What am I missing here to get it to work?

PS. Don't know why it puts a space between VR and ID at the 1st expression it isn't there
 
Looks like it is concatenating the values instead of Adding them.. Try.. a Wrapper function.. Something like..
Code:
UsedAF: [URL="http://www.techonthenet.com/access/functions/datatype/clng.php"]CLng([/URL]Nz(DSum("AF_lengte+AF_zaagbreedte";"VRMUTSTAF";"VRID = " & [VR].[VRID]);0))

UsedRES: [URL="http://www.techonthenet.com/access/functions/datatype/clng.php"]CLng([/URL]Nz(DSum("RES_lengte+RES_zaagbreedte";"VRRESSTAF";"VRID = " & [VR].[VRID]);0))

Used: [UsedRES]+[UsedAF]
Just Curious, is your Computer settings different? Normally , (comma) is the separator.. But you have used ; (semi colon)

Also, are AF_lengte+AF_zaagbreedte and RES_lengte+RES_zaagbreedte your actual field names?
 
No idea about the ; I just know that the , doesn't work in this function. Let me try that Wrapper function.

Edit: Works like a charm thanks Paul for the quick help!
 
Last edited:
Just Curious, is your Computer settings different? Normally , (comma) is the separator.. But you have used ; (semi colon)

For the dutch regional settings the comma is for decimal places. Because numbers have no need for quotes the seperator for querys changed to a semi colun.
 
For the dutch regional settings the comma is for decimal places. Because numbers have no need for quotes the seperator for querys changed to a semi colun.
Thought it might be something like that.. Thanks for clarifying.. :D
 

Users who are viewing this thread

Back
Top Bottom