Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum Unbound Textbox with WHERE Clause 1

Status
Not open for further replies.

RaphDawg

Technical User
Apr 19, 2008
10
US
I have a form with an Unbound text box called NonTaxPrice where I want to SUM records WHERE the Taxable column = -1. Right now I have an Unbound text box named ExtendedPrice that SUMS ALL records to give me a total price. It works as expected but my problem is I need to display a separate amount for taxable and Non-taxable records. I added the Taxable column to identify Non-taxable records, but I can’t figure out how to setup a WHERE clause for another Unbound text box so I can display the Non-taxable amount.
Note I tried the following syntax in the NonTaxPrice Control source but I get a syntax error - You may have entered an operand without an operator:
=Sum (“[ExtendedPrice] ”, “qrySalesDetails”, “[Taxable] = “ & -1)
 
Actually this should be it:

=Sum(IIf([Taxable]=-1,Nz([ExtendedPrice],0),0)
 
Hey THANKS!!!
Used this syntax:
=Sum(IIf([Taxable]=-1,Nz([ExtendedPrice],0),0)

I now am getting the following error:
The expression you entered is missing a closing parenthesis, bracket (]), or vertical bar (I).
Any thoughts??
 
Thanks I got it!!!
Added parenthesis at the end and it worked!

=Sum(IIf([Taxable]=-1,Nz([ExtendedPrice],0),0))

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top