Conditional statement in a text box?

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
 
B

BruceM

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

plh

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
 

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

Similar Threads


Top