Question about IIF statement

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])
 
G

Guest

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?)
 
D

Douglas J Steele

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

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