IIF Statement Definition

  • Thread starter NeonSky via AccessMonster.com
  • Start date
N

NeonSky via AccessMonster.com

Hello,

Would someone explain to me what exactly the below is doing? I understand
everything up to the "Mod 2)...." Thanks!

IIf((Sum(IIf([Day1] Is Null,1,2)) Mod 2)=0,Sum([Day1]),"SA")
 
K

Klatuu

IIf((Sum(IIf([Day1] Is Null,1,2)) Mod 2)=0,Sum([Day1]),"SA")

IIf([Day1] Is Null,1,2)
This part will return 1 if Day1 is Null; otherwise it returns 2

(Sum(IIf([Day1] Is Null,1,2))
The values returned are then summed for the records
If the number returned is an even number the Mod 2 will return 0

If 0 is returned from the Mod, Sum([Day1]) will be returned
Otherwise, "SA" is returned.
 
N

NeonSky via AccessMonster.com

Very helpful, thank you!
Klatuu said:
IIf((Sum(IIf([Day1] Is Null,1,2)) Mod 2)=0,Sum([Day1]),"SA")

IIf([Day1] Is Null,1,2)
This part will return 1 if Day1 is Null; otherwise it returns 2

(Sum(IIf([Day1] Is Null,1,2))
The values returned are then summed for the records
If the number returned is an even number the Mod 2 will return 0

If 0 is returned from the Mod, Sum([Day1]) will be returned
Otherwise, "SA" is returned.
Hello,

Would someone explain to me what exactly the below is doing? I understand
everything up to the "Mod 2)...." Thanks!

IIf((Sum(IIf([Day1] Is Null,1,2)) Mod 2)=0,Sum([Day1]),"SA")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top