Page 1 of 2 12 LastLast
Results 1 to 15 of 19

Thread: IIF function

  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: IIF function

    I have problem with the report, there is field called country, I used iif function, it always show #error. Could you please check it for me?

    IIF(IsNull([Country]),"",[Country])

    If I change to

    IIF(IsNull([Country]),"","This is Country field"). It will show "This is Country field with all record.

    Thanks.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    You will probably have a control called Country on your form. Rename it to something else.

    Also - NZ() is a neater way of doing what you are doing.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Mar 2004
    Posts
    660
    Yes, thanks it works. But i didn't use NZ(), it works, If i use nz() is that:

    IIF(nz([Country]=""),"",[Country]) . But i tried this is not working.

    Thanks.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Look up NZ() in help - the point is you don't need to use Iif.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Mar 2004
    Posts
    660
    Quote Originally Posted by pootle flump
    Look up NZ() in help - the point is you don't need to use Iif.
    Oh, i see. I got, thank you!

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    yyu - wouldn't it be nice if you searched the forum for a question similar to yours and found the answer posted at the end of the thread?
    George
    Home | Blog

  7. #7
    Join Date
    Mar 2004
    Posts
    660
    Quote Originally Posted by georgev
    yyu - wouldn't it be nice if you searched the forum for a question similar to yours and found the answer posted at the end of the thread?
    Once i got chance, i will search the forum online then I will post it if i find. Sorry for the bother.

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Hey yyu,
    What I meant was - you appeared to find the answer to your original question - it'd be nice if you shared it with everyone
    George
    Home | Blog

  9. #9
    Join Date
    Mar 2004
    Posts
    660
    Quote Originally Posted by georgev
    Hey yyu,
    What I meant was - you appeared to find the answer to your original question - it'd be nice if you shared it with everyone
    I am sorry, i didn't use NZ(), i use IIF. at this point, i can't use iif. For fixing my problem, i have mentioned that, i change the name of control that pootle flump gave me the suggestion, then it works. Thanks.

  10. #10
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Heh.
    Code:
    IIF(IsNull([Country]),"",[Country])
    ==
    Code:
    NZ([Country],"")
    Testimonial:
    pootle flump
    ur codings are working excelent.

  11. #11
    Join Date
    Mar 2004
    Posts
    660
    Quote Originally Posted by pootle flump
    Heh.
    Code:
    IIF(IsNull([Country]),"",[Country])
    ==
    Code:
    NZ([Country],"")
    Wow, it is great, i tried. It works. But i would like to show the "country:" if there is a value for country. Is it possible use Nz(). I use:
    IIF(IsNull([Country]),"","Country: "& [Country])

    Thank you very much!

  12. #12
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Cunning use of + concatenator:
    Code:
    NZ("Country: " + [Country],"")
    Testimonial:
    pootle flump
    ur codings are working excelent.

  13. #13
    Join Date
    Mar 2004
    Posts
    660
    Quote Originally Posted by pootle flump
    Cunning use of + concatenator:
    Code:
    NZ("Country: " + [Country],"")
    Thank you. It works. As i tried NZ("Country: " & [Country],""). It didn't work. It shows coutry for all the record. Thanks again.

  14. #14
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    That's because
    "Country: " & [Country]
    Will NEVER be NULL... "Country: " is a value, eh?
    George
    Home | Blog

  15. #15
    Join Date
    Mar 2004
    Posts
    660
    Quote Originally Posted by georgev
    That's because
    "Country: " & [Country]
    Will NEVER be NULL... "Country: " is a value, eh?
    Haha, I got it.

Posting Permissions

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