Summing field values on report w/ comparators

JayDubya

New member
Local time
Today, 09:32
Joined
Dec 11, 2009
Messages
6
I am trying to count records based on multiple criteria in the report footer in an unbound text box. I get an error that the expression is too complicated. Please advise

Sum(IIF([txtField1] = "value1" And [txtField2] = "value2",1,0))

Sum(IIF([txtField1] = "value1" Or [txtField2] = "value2" And [txtField3] ="value3",1,0))

I realize this may be able to be done in another way, but I am very new to Access queries. I am using Access 2003.

Thanks in advance.
 
Looks okay; do you have the equals sign at the beginning?
 
Yes, I have an = sign at the beginning.

I have it in the report footer, is there any other settings I might be missing? When I move it to the Page Footer, I get #Error, but the report will print. When I put it in the report footer (where I need it), I get the error 3071 (Expression is typed incorrectly or too complex...).

I have the running sum set to "Over All" and ensured that there are no "null" values in the records.
 
You can't use the page footer, only the report footer (or a group footer). Make sure that no controls have the same name as a field, which they will if you used the wizard to create the report. That can cause problems. If the fields are numeric (their data type), don't use quotes around the values.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom