Sum IIF with Multiple Condition

maabbas

Registered User.
Local time
Today, 13:07
Joined
Feb 15, 2012
Messages
69
How will I make a IIF formula with sum if 3 conditions are are true. I am trying to make a query which sum the Lbs Produce if date, Product Id and location met.

Thanks in Advance
 
You use 'AND'. For example:

Iif(([Age]>5) AND ([Age]<10) AND ([FirstName] Like "Ste*"), 1, 0)
 
You use 'AND'. For example:

Iif(([Age]>5) AND ([Age]<10) AND ([FirstName] Like "Ste*"), 1, 0)

I use the following formula but its not working

Sum(IIf(
=[table_number] And ([Date]=[Date]AND([Product]=[Product_ID],[Lbs_produce],0))
 
First, [Date]=[Date] is pointless, an entity is always going to equal itself. Second 'Date' is a horrible name for a field because its a reserved word (http://support.microsoft.com/kb/286335). Third, you have 4 left parenthesis and 2 right parenthesis.
 
I don't know how to do it, I just want when user enter data, and want to verify that all the numbers are correctly enter.

What I was trying to make query and add button in the form when user finishes data entry, hit that button and enter Date, Product Code and Table number the query bring the result with sum.
 
I don't know how to do it,

I'm trying to guide you to doing it. That last example of code you provided wasn't syntatically correct because of your parenthesis. Code (like writing) requires that you close every open parenthesis (so if you nest parenthesis (like this) you need to make sure you close them all, like this->). That previous sentence had 3 left parenthesis and 3 right parenthesis, so it was well-formed. Code works the same way, you need a right parenthesis for every left parenthesis and vice versa.

Go back to the code you posted and make sure you have equal number of left and right parenthesis. And don't just add a bunch at the beginning or end to even the count out--place them in the correct spot. You are essentially building a math equation:

(7 + 3)*2 does not equal 7 + (3*2)

Placement is important.
 
I'm trying to guide you to doing it. That last example of code you provided wasn't syntatically correct because of your parenthesis. Code (like writing) requires that you close every open parenthesis (so if you nest parenthesis (like this) you need to make sure you close them all, like this->). That previous sentence had 3 left parenthesis and 3 right parenthesis, so it was well-formed. Code works the same way, you need a right parenthesis for every left parenthesis and vice versa.



Go back to the code you posted and make sure you have equal number of left and right parenthesis. And don't just add a bunch at the beginning or end to even the count out--place them in the correct spot. You are essentially building a math equation:

(7 + 3)*2 does not equal 7 + (3*2)

Placement is important.

Looks like I have to go back school, thanks for help finally I got it
 

Users who are viewing this thread

Back
Top Bottom