I have the following expression in a query:
Actual Month: Sum(IIf(Len([header]=3),[qty]))
basically I want a sum of quantity if the length of header = 3.
But when I try to run the query, i get :
"This expression is typed incorrectly, or it is too complex to be
evaluated...."
Any ideas?
KARL DEWEY - 23 Apr 2008 19:06 GMT
Do you actually have a field named 'header'?
What kind of data do you store there?

Signature
KARL DEWEY
Build a little - Test a little
> I have the following expression in a query:
>
[quoted text clipped - 8 lines]
>
> Any ideas?
Jerry Whittle - 23 Apr 2008 19:38 GMT
IIf requires three parts: The expression, true part, false part. I don't see
the false part in yours.

Signature
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
> I have the following expression in a query:
>
[quoted text clipped - 8 lines]
>
> Any ideas?
John Spencer - 23 Apr 2008 19:48 GMT
Misplaced parentheses could be the problem. And I would also include a value
for the False result.
Actual Month: Sum(IIf(Len([header])=3,[qty],Null))
I don't think there will be any problem is Header contains null.
You could also write this as
Actual Month: Sum(IIf([header] Like "???",[qty],Null))
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
> I have the following expression in a query:
>
[quoted text clipped - 8 lines]
>
> Any ideas?
erick-flores - 24 Apr 2008 20:59 GMT
Thanks for the replies. I ended up using another field in the IF
statement so I dont need to calculate the length of anything.