Expression question

  • Thread starter Slez via AccessMonster.com
  • Start date
S

Slez via AccessMonster.com

I have the following expression in a report control's Control Source:

=Sum(Iif([CBDCodeID]=11,0,[LineMaterialCost]))

I need to expand that so that anything with CBDCodeID = 15 and 16 also
doesn't add the LineMaterialCost. How do I go about doing that? Any help is
appreciated!
Thanks!
 
J

John Spencer

Try this

=Sum(IIf([CBDCodeID] in (11,15,16),0,[LineMaterialCost]))

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
S

Slez via AccessMonster.com

This returned #Error in the field. The other response from Klatuu worked
correctly, but thank you for the help!

John said:
Try this

=Sum(IIf([CBDCodeID] in (11,15,16),0,[LineMaterialCost]))

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
I have the following expression in a report control's Control Source:
[quoted text clipped - 4 lines]
appreciated!
Thanks!
 
J

John Spencer

My error. The IN construction only works in queries and not in expressions
used directly as a control source.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
This returned #Error in the field. The other response from Klatuu worked
correctly, but thank you for the help!

John said:
Try this

=Sum(IIf([CBDCodeID] in (11,15,16),0,[LineMaterialCost]))

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
I have the following expression in a report control's Control Source:
[quoted text clipped - 4 lines]
appreciated!
Thanks!
 

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