Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    NZ function (2000)

    I have two fields in a query that I am adding together. It is a simple Total: [field 1]+[field2]. Some of the records will not have a field2. How do I use the NZ function so that when nothing is there it will give me what is in field1. Like Field1 + nothing = Field1. I tried - Total: ([Field1] + (NZ[field2])) but it doesn't work. I know I am not doing this right. Thanks for your help......

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: NZ function (2000)

    Try
    <code>
    Total: [Field1]+Nz([Field2],0)
    </code>
    Note: according to the online help, Nz without a second argument should return 0 if the first argument is a number field with a null value, but I can't get Nz to do this consistently, so I always specify 0 explicitly.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: NZ function (2000)

    Thanks Hans. I appreciate your help. Do you ever sleep? What time is it in the Netherlands?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: NZ function (2000)

    It's 1:10 PM (13:10) here - I just had lunch.

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: NZ function (2000)

    Then it is me that never sleeps - it is 7:13 AM. I got to work at 6:10 AM. I am just having breakfast. Thanks again. You are a lifesaver.

Posting Permissions

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