Can't get IIF to work

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

Guest

Missing something obvious. I have a form with a control source:

=IIf([STD]<=[MAXSTD],"PASS","FAIL")

[STD] and [MAXSTD] are values on my form. No matter what FAIL is displayed,
even when [STD] > [MAXSTD].
 
If they are not fields in your record source and just object on the form you
need to reference them the same as you would in a query.

[Forms]![YourFormName]![STD]
and
[Forms]![YourFormName]![MAXSTD]

So it would look like this ---

=IIf([Forms]![YourFormName]![STD]<=[Forms]![YourFormName]![MAXSTD],"PASS","FAIL")
 
Are the Controls bound to numeric Fields?

Try something like:

= IIf(Val(Nz(Form![STD], 0)) <= Val(Nz(Form![MAXSTD], 0)),"PASS","FAIL")
 
Back
Top