• Addition in a Query (Access 2000/SR 1)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Addition in a Query (Access 2000/SR 1)

    Author
    Topic
    #422930

    Greetings all: I have this calculation in a query:

    Addl_Hours: nz([pals_hours])+nz([cpr_hours])+nz([btls_hours])+nz([acls_hours])

    I’m trying to accumulate addl_hours, however, the results show that the four fields are being concatenated instead of being added. I vaguely recall somewhere that the + sign is used as a concatenation operator, however, I want it to be an addition operator. Any and all help is appreciated. TIA.

    Viewing 0 reply threads
    Author
    Replies
    • #966049

      Looks like one (or more) of your fields is being recognised as a text (or other) field rather than a numerical value. There are two things I can think of trying:

      Firstly, check the properties of each field, and make sure they’re all set as number fields.

      The other (and probably more robust) solution is to use the Val() function:
      Addl_Hours: val(nz([pals_hours]))+val(nz([cpr_hours]))+val(nz([btls_hours]))+val(nz([acls_hours]))

      whisperIf that doesn’t work, try swapping the val()s and nz()s around

      • #966052

        Dave: That did the trick. Thanks much. Did not have to swap val() and nz()

    Viewing 0 reply threads
    Reply To: Addition in a Query (Access 2000/SR 1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: