Forum Discussion

Ganesh99's avatar
Ganesh99
Copper Contributor
Jan 11, 2023

iif statement in Access DB

Hi all,

 

I m unable to get my iif statement right.

I have a table Dec 22 in which 2 columns are SO and Description. Say if I want a True if the values in SO = Description and otherwise a False. How do I do it please?

 

I have added a new column "T/F" for this purpose in the same table. Which query should I use to start with?

An Update query?

 

I tried with T/F: iif([SO]=[Description],"True,"False" in the first row of the query which is Field.

 

 

Regards

Ganesh

+91 8451046072

  • arnel_gp's avatar
    arnel_gp
    Steel Contributor
    you may try:

    T/F: IIF((NZ([SO], "@") = NZ([DESCRIPTION], "#")), "TRUE", "FALSE")


    but the question, what if both are Null are they equal to you?
    if they are, use this:

    T/F: IIF((NZ([SO], "@") = NZ([DESCRIPTION], "@")), "TRUE", "FALSE")
    • Ganesh99's avatar
      Ganesh99
      Copper Contributor
      Hello there!

      Thanks for responding. I m using your inputs to enrich and try iterations.

      Regards
      Ganesh
    • Ganesh99's avatar
      Ganesh99
      Copper Contributor

      Hi, Harun24HR! Thanks.

       

      This interaction made me feel I m not alone here. Thanks again.

      I achieved this. I have been trying to use the Update query as I want this column to have True and False in an already existing table. I am getting an error test saying that there should be at least one destination. I guess the field - Update To can't be left blank. But we are supposed to write the iif function in the first row which happens to be field. So what do I write in Update to?

       

      I see that you have used Select query.

       

      Regards

      Ganesh

      +91 8451046072

Resources