Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    New Jersey
    Posts
    103
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Expression in Access (Access 2002)

    Hope someone can help.

    I have an access query tbat looks like the following

    Empid Name Number of cats Number of dogs Number of horses Calc to add cats, dogs and horses
    2222 John Doe 2 2 This comes up blank

    What I am trying to do is add up cats, dogs and horses but when one of the columns is blank, my formula comes back blank. It only adds up my three columns if a number apears for each of the columns.

    Help! <img src=/S/confused3.gif border=0 alt=confused3 width=45 height=45>

  2. #2
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression in Access (Access 2002)

    <P ID="edit" class=small>(Edited by gdrezek on 22-Sep-06 16:14. addedd link)</P>You can wrap the fields with the Nz function; i.e. Nz([fieldname], 0). Where if the value in fieldname] is null it will be replaced with 0 and not a null value.
    When you are using the plus sign (+), if one value is null then the calculated value is null.
    Here (Allen Browne's web site) is a good explanation of the use of nulls in Access.
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

  3. #3
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    New Jersey
    Posts
    103
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Expression in Access (Access 2002)

    Thank you. It worked perfectly. <img src=/S/bingo.gif border=0 alt=bingo width=15 height=22>

Posting Permissions

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