If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Error in IIf Expression
I have an expression in my query to create a concatenated text depending upon
the value of control Measurements. If the control is skipped - meaning that there are no Measurements, I'd like to return an expression to that extent. Here's my expression: Expr1: IIf([Measurements]=Null,"The damage is not such that it has a measurement height.","The height of the damage is " & [Measurements] & " inches.") I'm not getting an error, but I'm not getting it to read the True statement. It reads even the Null value as False and returns "The height of the damage is inches. Please help me see what I'm missing here! Thanks so much! Pamela |
#2
|
|||
|
|||
Error in IIf Expression
Pamela wrote:
I have an expression in my query to create a concatenated text depending upon the value of control Measurements. If the control is skipped - meaning that there are no Measurements, I'd like to return an expression to that extent. Here's my expression: Expr1: IIf([Measurements]=Null,"The damage is not such that it has a measurement height.","The height of the damage is " & [Measurements] & " inches.") I'm not getting an error, but I'm not getting it to read the True statement. It reads even the Null value as False and returns "The height of the damage is inches. Please help me see what I'm missing here! Thanks so much! Pamela Nothing is ever equal to Null. Something either Is or Is Not Null. So the immediate change is : IIf([Measurements] Is Null," -- HTH, Bob Barrows |
#3
|
|||
|
|||
Error in IIf Expression
Maybe it is not null but a zero lenght string.
Use this -- Expr1: IIf([Measurements]=Null OR [Measurements]="","The damage is not such that it has a measurement height.","The height of the damage is " & [Measurements] & " inches.") -- Build a little, test a little. "Pamela" wrote: I have an expression in my query to create a concatenated text depending upon the value of control Measurements. If the control is skipped - meaning that there are no Measurements, I'd like to return an expression to that extent. Here's my expression: Expr1: IIf([Measurements]=Null,"The damage is not such that it has a measurement height.","The height of the damage is " & [Measurements] & " inches.") I'm not getting an error, but I'm not getting it to read the True statement. It reads even the Null value as False and returns "The height of the damage is inches. Please help me see what I'm missing here! Thanks so much! Pamela |
#4
|
|||
|
|||
Error in IIf Expression
Thanks, Karl,
But that still didn't do it. I had actually tried that same thing earlier instead of the "Null" but I now tried it w/ the OR as you suggested and I still get the same thing: "The height of the damage is inches." Any other ideas??? "KARL DEWEY" wrote: Maybe it is not null but a zero lenght string. Use this -- Expr1: IIf([Measurements]=Null OR [Measurements]="","The damage is not such that it has a measurement height.","The height of the damage is " & [Measurements] & " inches.") -- Build a little, test a little. "Pamela" wrote: I have an expression in my query to create a concatenated text depending upon the value of control Measurements. If the control is skipped - meaning that there are no Measurements, I'd like to return an expression to that extent. Here's my expression: Expr1: IIf([Measurements]=Null,"The damage is not such that it has a measurement height.","The height of the damage is " & [Measurements] & " inches.") I'm not getting an error, but I'm not getting it to read the True statement. It reads even the Null value as False and returns "The height of the damage is inches. Please help me see what I'm missing here! Thanks so much! Pamela |
#5
|
|||
|
|||
Error in IIf Expression
I repeat:
IIf([Measurements]=Null will always return false. Nothing is ever considered to be equal to Null. At the very least, you need to change it to: IIf([Measurements] Is Null or use the IsNull() function: Iif(IsNull([Measurements]), Pamela wrote: Thanks, Karl, But that still didn't do it. I had actually tried that same thing earlier instead of the "Null" but I now tried it w/ the OR as you suggested and I still get the same thing: "The height of the damage is inches." Any other ideas??? "KARL DEWEY" wrote: Maybe it is not null but a zero lenght string. Use this -- Expr1: IIf([Measurements]=Null OR [Measurements]="","The damage is not such that it has a measurement height.","The height of the damage is " & [Measurements] & " inches.") -- Build a little, test a little. "Pamela" wrote: I have an expression in my query to create a concatenated text depending upon the value of control Measurements. If the control is skipped - meaning that there are no Measurements, I'd like to return an expression to that extent. Here's my expression: Expr1: IIf([Measurements]=Null,"The damage is not such that it has a measurement height.","The height of the damage is " & [Measurements] & " inches.") I'm not getting an error, but I'm not getting it to read the True statement. It reads even the Null value as False and returns "The height of the damage is inches. Please help me see what I'm missing here! Thanks so much! Pamela -- HTH, Bob Barrows |
#6
|
|||
|
|||
Error in IIf Expression
On Mon, 4 Jan 2010 08:52:01 -0800, KARL DEWEY
wrote: Maybe it is not null but a zero lenght string. Use this -- Expr1: IIf([Measurements]=Null OR [Measurements]="","The damage is not such that it has a measurement height.","The height of the damage is " & [Measurements] & " inches.") Can I offer you a cup of my excellent Costa Rican coffee, Karl? g Bob's right - the problem is the =Null expression. It will never be TRUE (in fact any expression X=NULL will always be NULL, and treated as if it were FALSE). A safe and (surprisingly to me) fast expression is IIf(Len([Measurements] & "") = 0, ... -- John W. Vinson [MVP] |
Thread Tools | |
Display Modes | |
|
|