Sum of multiple text boxes on form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • djgeverson
    New Member
    • Feb 2014
    • 10

    Sum of multiple text boxes on form

    Hi there,

    I am trying to add together 4 fields on a form to give total sumation. I have created the expression:

    Code:
    =Nz([txtprice],0)+Nz([txtshippping],0)+Nz([txtimporttax],0)+Nz([txtadditionalcosts],0)
    But when values are entered into the appropriate txt boxes instead of adding all the values together to give a sumation, it just adds them together i.e. if the numbers in the text boxes are 3, 4, 5 and 6, I want to add them together to get 18, whereas the expression gives 3456!

    Any ideas!
    Last edited by zmbd; Mar 19 '14, 07:06 PM. Reason: [Z{Please use the [CODE/] button to format posted script and formated text - Please read the FAQ}]
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    NZ returns a string value. Try
    Code:
    Cdbl(Nz([txtprice],0))+Cdbl(Nz([txtshippping],0))+Cdbl(Nz([txtimporttax],0))+Cdbl(Nz([txtadditionalcosts],0))
    Also pay attention to the formatting on the text box that will display this sum.

    Jim

    Comment

    • djgeverson
      New Member
      • Feb 2014
      • 10

      #3
      Thanks it worked first time!!

      Comment

      Working...