Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2013
    Posts
    99

    Unanswered: Creating an expression with null Values

    Not sure on how this works I need to create and expression that caluculates some feilds but if any of the feilds are empty then the caluculation does not work.

    So I persume that you need a iif(isnull( but cannot get it to work do you need a isnull before each feild ?

    This is what I have currently

    iif(isnull([extrahoursCH]+[extrahoursch1]+[extrahoursch2]))

    Thank you

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by pjawynn View Post
    do you need a isnull before each feild ?
    Yes. However I would use the Nz() function in this scenario: Nz Function - Access - Office.com
    Code:
    Nz([extrahoursCH], 0) + Nz([extrahoursch1], 0) + Nz([extrahoursch2], 0)
    George
    Home | Blog

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if you expect to use these values in calculations then I doubt they should be null
    personally I'd set the default value for each column to be zero

    NULL has a very specific meaning in db terms, such as:-
    we don't know what the value is yet(if ever)
    we want to specifically leave as 'empty' / no value

    in this case I'd argue that its perfectly reasonable to have 0 as the default for something containing 'hours' or discrete amounts of time
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Feb 2013
    Posts
    99

    Thank you

    Gvee thanks for the reply

    Really helpful to have the referance as well as the solution

    Once again thanks

    Pjawynn

Posting Permissions

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