Adding columns in a query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ielamrani
    New Member
    • Feb 2007
    • 72

    #1

    Adding columns in a query

    Hi,
    this is very strange. I am trying to add 2 columns in a query but it does not come out right.

    Column1 Column2 Column3

    $15.00 $30.00 $15.00$30.00

    Column3 should equal $45.00.

    When I subtract, divide or multiply it's fine. It does not work when i tried to add. this is the code behind Column3: Format(nz([Column1])+nz(Column2)," Currency")

    Thanks in advance
  • jaxjagfan
    Recognized Expert Contributor
    • Dec 2007
    • 254

    #2
    Originally posted by ielamrani
    Hi,
    this is very strange. I am trying to add 2 columns in a query but it does not come out right.

    Column1 Column2 Column3

    $15.00 $30.00 $15.00$30.00

    Column3 should equal $45.00.

    When I subtract, divide or multiply it's fine. It does not work when i tried to add. this is the code behind Column3: Format(nz([Column1])+nz(Column2)," Currency")

    Thanks in advance
    It's concatenating - NZ returns a string value.

    Column3: Format(Cdbl(nz([Column1],0)) + Cdbl(nz([Column2],0)),"Currency" )

    Comment

    • ielamrani
      New Member
      • Feb 2007
      • 72

      #3
      Thank you so much. It worked.

      Comment

      Working...