need help with expression

E

erick-flores

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?
 
K

KARL DEWEY

Do you actually have a field named 'header'?
What kind of data do you store there?
 
J

Jerry Whittle

IIf requires three parts: The expression, true part, false part. I don't see
the false part in yours.
 
J

John Spencer

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
 
E

erick-flores

Thanks for the replies. I ended up using another field in the IF
statement so I dont need to calculate the length of anything.
 

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

Top