iif statement in Access DB

Copper Contributor

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

4 Replies

@Ganesh99 Try the below query. See the attached file.

 

SELECT Table1.SO, Table1.Description, IIF([SO]=[Description],"TRUE","FALSE") as [Boolean] FROM Table1;

 

 Harun24HR_0-1673426418675.png

 

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")

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

Hello there!

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

Regards
Ganesh