Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple If statement

Status
Not open for further replies.

Joe1010

Programmer
Dec 11, 2006
49
US
This is very simple but I do not know it.
What is wrong with the if statement below?

if ({tableOne.fieldOne}) = "Y" then "Y"
else "n"

Thanks
 
Try taking out the () so it looks like this.

if {tableOne.fieldOne} = "Y" then "Y"
else "n
 
It returns Y if fieldOne = Y
However, if it is blank, it returns nothing.
The () did not make any change.

Thanks
 
Try:

if isnull({tableOne.fieldOne})
or
trim({tableOne.fieldOne}) = ""
or
{tableOne.fieldOne} <> "Y" then
"N"
else
"Y"

-k
 
if the field is blank you have to account for this in your formula. It would be something like this

if isnull({tableOne.fieldOne})or {tableOne.fieldOne} = ""
Then "Not Indicated"
else if {tableOne.fieldOne} = "Y" then "Y"
else "n
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top