Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Columbus, Ohio, USA
    Posts
    286
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Addition in a Query (Access 2000/SR 1)

    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.

  2. #2
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Addition in a Query (Access 2000/SR 1)

    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]))

    <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17>If that doesn't work, try swapping the val()s and nz()s around
    Waggers
    If at first you do succeed, you&#39;ve probably missed something.

  3. #3
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Columbus, Ohio, USA
    Posts
    286
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Addition in a Query (Access 2000/SR 1)

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •