Conditional statement in a text box?

  • Thread starter Thread starter plh
  • Start date Start date
P

plh

How can I make a conditional statement in a text box? I have a recollection of
using "iff" but it does not seem to be working.
Right now I have
=[txtSize]/25.4
in text box "txtImpEquiv".
This is of course to give the Imperial equivalent of a metric value in txtSize.
I want to make this conditional on the value of "chkMetric", a check box.
If chkMetric = -1, I want to show the value, if not, I want a blank cell.
I tried =iff[chkMetric=-1,[txtSize]/25.4,""] but Access says this contains an
invalid syntax.
Thanx,
-plh
 
It's IIf, not Iff, and it uses parentheses, not square brackets. Square
brackets are for field and control names (and a few other uses). Access
will usually add square brackets to an expression if you leave them out.
=IIf([chkMetric] = -1,[txtSize]/25.4,"")
 
Works perfectly!
Thank You,
-plh

It's IIf, not Iff, and it uses parentheses, not square brackets. Square
brackets are for field and control names (and a few other uses). Access
will usually add square brackets to an expression if you leave them out.
=IIf([chkMetric] = -1,[txtSize]/25.4,"")

plh said:
How can I make a conditional statement in a text box? I have a
recollection of
using "iff" but it does not seem to be working.
Right now I have
=[txtSize]/25.4
in text box "txtImpEquiv".
This is of course to give the Imperial equivalent of a metric value in
txtSize.
I want to make this conditional on the value of "chkMetric", a check box.
If chkMetric = -1, I want to show the value, if not, I want a blank cell.
I tried =iff[chkMetric=-1,[txtSize]/25.4,""] but Access says this contains
an
invalid syntax.
Thanx,
-plh
 
Back
Top