Question about IIF statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a 2 fields in my table/Form field XYZ and ABC
if XYz is true then ABC needs to be true
if XYZ is true and ABC is missing, then ABC will have a "missing" value

I have the following statement as a control source for my text box on my
form but its giving me an error.
=IIf(IsNull([ABC] & [XYZ])=True,"Missing",[ABC])
 
Try this

IIf([ABC] Is Null And [XYZ] Is Null,"Missing",[ABC])

But from your explenation I can't fully understand what you need
if XYz is true then ABC needs to be true
if XYZ is true and ABC is missing, then ABC will have a "missing" value
(but the first condition been applied, so there is no need for this
condition, XYZ is true, Now what if it False?)
 
Part of your problem is that you're referring to ABC in the IIf statement
that's setting ABC's value. As well, if you're expecting ABC to be a boolean
value (True/False), it can't have a value of Missing.

What happens if XYZ is False? The following assumes ABC will be set to the
word False.

IIf(IsNull([ABC]) AND [XYZ],"Missing", Format([XYZ],"True/False"))
 
Back
Top