IIF statement error ??

P

petrovlis

I try to make following IIF statement

IIF([Unit]="FCL","each"+[contweight]) ------>> getting #erro

IIF([Unit]="FCL",[contweight]) that is Okay, ----but I need the word "each" in the query/repor

What is wrong in the first line ??

William
 
D

Douglas J. Steele

Andrew's suggestion of using & rather than + should work. I'm surprised,
though, that the 2nd statement works, since IIf requires 3 parameters, not
2. The 3rd parameter tells it what to use if the results of the first
parameter are false.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


petrovlis said:
I try to make following IIF statement:

IIF([Unit]="FCL","each"+[contweight]) ------>> getting #error

IIF([Unit]="FCL",[contweight]) that is Okay, ----but I need the
word "each" in the query/report
 
S

Steve Schapel

Doug,

Depends what you mean by "requires". If you don't provide a 'falsepart'
argument, IIf() returns Null when the 'condition' is false. This is, of
course, undocumented, but I must admit I have done this myself many
times over the years, with no resultant grief.
 
S

Steve Schapel

Andrew,

This is not correct. See my earlier post. If the "third element" is
not specified, the IIf() function returns Null, not "".
 
Top