Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IIf with IsNull (Access 2000)

    I have a good IIF Function based on the availablity of a field, which sometimes might be 0 and sometimes there is nothing in it.My function works, if the filed cartons is either 0 or > 0. However, my function does not work if the field cartons is blank, i.e. there is no 0 in it. How an I improve my Iif function so to include both three cases : when it is Null, hen it is 0 and when it >0 ?
    NetPrice: IIf([cartons]>0;[ddp]*[cartons]*[size]*[pack];IIf([cartons]=0;[ddp]*[size]*[quantity];0))

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

    Re: IIf with IsNull (Access 2000)

    What do you want the result to be if Cartons is Null?

  3. #3
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIf with IsNull (Access 2000)

    I get the net price either by multiplying cartons*size if cartons > 0.
    Or, when the cartons is 0 I get the net price by multiplying ddp*size*quantity.
    I want to multiply ddp*size*quantity also when cartons is nil, when there is no 0 in the field.
    Thank you in advance

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

    Re: IIf with IsNull (Access 2000)

    In that case, the expression can be simplified to

    NetPrice: IIf([cartons]>0;[ddp]*[cartons]*[size]*[pack];[ddp]*[size]*[quantity])

    The "else" part covers all situations where cartons > 0 is not true. This includes cartons = 0 and cartons is null.

  5. #5
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IIf with IsNull (Access 2000)

    Many Thank. It is great what i have done with this new line.Thank you Hans

Posting Permissions

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