Totals based on Iif statement in subreport

M

MacNut2004

Hello,

I have some fields in a subreport -- ID, category and amount, that I need to
total. For instance, I need a total of "amount" where each category is
"200", not including any other cateogry.

How do I do this? I Tried it, and it worked when there was only ONE RECORD
in that particular ID. If there was a category 200 and another record for
that ID that was 203, it's adding the amoutns for both categories together.
What am I doing wrong?

here is my if statement:
=IIf([Category]=200,Sum([Amount]),0)

Thank you!
MN
 
A

Al Campagna

Mac,
Place a calculated field in your query behind the report...
IAm200 : IIF(Category = 200, Amount, 0)
Place IAm200 on the report (can be hidden), and in any Footer...
=Sum(IAm200) will yield the result.
That should do it...
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
A

Al Campagna

Mac,
Also, without the query calculated field... in any footer...
= Sum(IIF(Category = 200, 200, 0))

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
M

Marshall Barton

MacNut2004 said:
I have some fields in a subreport -- ID, category and amount, that I need to
total. For instance, I need a total of "amount" where each category is
"200", not including any other cateogry.

How do I do this? I Tried it, and it worked when there was only ONE RECORD
in that particular ID. If there was a category 200 and another record for
that ID that was 203, it's adding the amoutns for both categories together.
What am I doing wrong?

here is my if statement:
=IIf([Category]=200,Sum([Amount]),0)


=Sum(IIf([Category]=200,[Amount],0))
 
M

MacNut2004

Thanks for your response Al,

However,I'm getting errors for both calculated fields in the subreport. I
tried both methods, using it in the query behind the scenes and the numbers
are coming through but when i try using the sum(iam200) in a calculated
field, it comes up as an error. what am i doing wrong?

Thanks,
MN

Al Campagna said:
Mac,
Place a calculated field in your query behind the report...
IAm200 : IIF(Category = 200, Amount, 0)
Place IAm200 on the report (can be hidden), and in any Footer...
=Sum(IAm200) will yield the result.
That should do it...
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


MacNut2004 said:
Hello,

I have some fields in a subreport -- ID, category and amount, that I need to
total. For instance, I need a total of "amount" where each category is
"200", not including any other cateogry.

How do I do this? I Tried it, and it worked when there was only ONE RECORD
in that particular ID. If there was a category 200 and another record for
that ID that was 203, it's adding the amoutns for both categories together.
What am I doing wrong?

here is my if statement:
=IIf([Category]=200,Sum([Amount]),0)

Thank you!
MN
 
M

MacNut2004

Also, I meant to say it was a subFORM, not report, if that makes any
difference with those errors.

Thanks!
MN

Al Campagna said:
Mac,
Also, without the query calculated field... in any footer...
= Sum(IIF(Category = 200, 200, 0))

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

MacNut2004 said:
Hello,

I have some fields in a subreport -- ID, category and amount, that I need to
total. For instance, I need a total of "amount" where each category is
"200", not including any other cateogry.

How do I do this? I Tried it, and it worked when there was only ONE RECORD
in that particular ID. If there was a category 200 and another record for
that ID that was 203, it's adding the amoutns for both categories together.
What am I doing wrong?

here is my if statement:
=IIf([Category]=200,Sum([Amount]),0)

Thank you!
MN
 
A

Al Campagna

MacNut,
Well, the concept is the same for a subform, or a report.
I may have made a typo in my second reply... see below. I think I pasted some code
from my testing by mistake.

First, use a continuous subform, and in the Form Footer, place a field named
Total200Amounts (don't use a name that matches the name of any element in the
calculation), and give that a ControlSource of...
=Sum(IIF(Category = 200, [Amount], 0))
Amount can't be a calculated field itself, it should be a "bound" field.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


MacNut2004 said:
Also, I meant to say it was a subFORM, not report, if that makes any
difference with those errors.

Thanks!
MN

Al Campagna said:
Mac,
Also, without the query calculated field... in any footer...
= Sum(IIF(Category = 200, 200, 0))

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

MacNut2004 said:
Hello,

I have some fields in a subreport -- ID, category and amount, that I need to
total. For instance, I need a total of "amount" where each category is
"200", not including any other cateogry.

How do I do this? I Tried it, and it worked when there was only ONE RECORD
in that particular ID. If there was a category 200 and another record for
that ID that was 203, it's adding the amoutns for both categories together.
What am I doing wrong?

here is my if statement:
=IIf([Category]=200,Sum([Amount]),0)

Thank you!
MN
 
M

MacNut2004

Al,

I tried putting "Iam200" in the query behind the scenes and then the
sum(Iam200) in the form footer and i have an error in that calculated field
in the form. What am I doing wrong? The following is what I have in my query:

Iam200: IIf([Category]=200,[Amount],0)

Thank you,
MN

Al Campagna said:
MacNut,
Well, the concept is the same for a subform, or a report.
I may have made a typo in my second reply... see below. I think I pasted some code
from my testing by mistake.

First, use a continuous subform, and in the Form Footer, place a field named
Total200Amounts (don't use a name that matches the name of any element in the
calculation), and give that a ControlSource of...
=Sum(IIF(Category = 200, [Amount], 0))
Amount can't be a calculated field itself, it should be a "bound" field.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


MacNut2004 said:
Also, I meant to say it was a subFORM, not report, if that makes any
difference with those errors.

Thanks!
MN

Al Campagna said:
Mac,
Also, without the query calculated field... in any footer...
= Sum(IIF(Category = 200, 200, 0))

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Hello,

I have some fields in a subreport -- ID, category and amount, that I need to
total. For instance, I need a total of "amount" where each category is
"200", not including any other cateogry.

How do I do this? I Tried it, and it worked when there was only ONE RECORD
in that particular ID. If there was a category 200 and another record for
that ID that was 203, it's adding the amoutns for both categories together.
What am I doing wrong?

here is my if statement:
=IIf([Category]=200,Sum([Amount]),0)

Thank you!
MN
 
A

Al Campagna

MacNut,
Did you read my last post on 4/11 @ 12:24? Please do....

Please answer all...
Is Category a "bound" Numeric field, and is Category on the subform?
Is Amount a "bound" Numeric field, and *NOT* a calculated field (Like... Price * Qty =
Amount)
When you say you get an error, is it "#Error"

To simplify the matter, why don't we just try the Footer calculation. Remove the
IAm200 from the query, and we'll try to summ the 200 Amounts directly in the footer.
Again, Amount can not be a calculated field on the subform...

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."



MacNut2004 said:
Al,

I tried putting "Iam200" in the query behind the scenes and then the
sum(Iam200) in the form footer and i have an error in that calculated field
in the form. What am I doing wrong? The following is what I have in my query:

Iam200: IIf([Category]=200,[Amount],0)

Thank you,
MN

Al Campagna said:
MacNut,
Well, the concept is the same for a subform, or a report.
I may have made a typo in my second reply... see below. I think I pasted some code
from my testing by mistake.

First, use a continuous subform, and in the Form Footer, place a field named
Total200Amounts (don't use a name that matches the name of any element in the
calculation), and give that a ControlSource of...
=Sum(IIF(Category = 200, [Amount], 0))
Amount can't be a calculated field itself, it should be a "bound" field.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


MacNut2004 said:
Also, I meant to say it was a subFORM, not report, if that makes any
difference with those errors.

Thanks!
MN

:

Mac,
Also, without the query calculated field... in any footer...
= Sum(IIF(Category = 200, 200, 0))

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Hello,

I have some fields in a subreport -- ID, category and amount, that I need to
total. For instance, I need a total of "amount" where each category is
"200", not including any other cateogry.

How do I do this? I Tried it, and it worked when there was only ONE RECORD
in that particular ID. If there was a category 200 and another record for
that ID that was 203, it's adding the amoutns for both categories together.
What am I doing wrong?

here is my if statement:
=IIf([Category]=200,Sum([Amount]),0)

Thank you!
MN
 
M

MacNut2004

Al,

Yes I did read it. They are both bound numeric fields....not calculated
fields.

Yes, when I get an error...it reads #Error. I have put the calculated
fields on the subform only...and i am still getting that error.

Thanks,
MN

Al Campagna said:
MacNut,
Did you read my last post on 4/11 @ 12:24? Please do....

Please answer all...
Is Category a "bound" Numeric field, and is Category on the subform?
Is Amount a "bound" Numeric field, and *NOT* a calculated field (Like... Price * Qty =
Amount)
When you say you get an error, is it "#Error"

To simplify the matter, why don't we just try the Footer calculation. Remove the
IAm200 from the query, and we'll try to summ the 200 Amounts directly in the footer.
Again, Amount can not be a calculated field on the subform...

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."



MacNut2004 said:
Al,

I tried putting "Iam200" in the query behind the scenes and then the
sum(Iam200) in the form footer and i have an error in that calculated field
in the form. What am I doing wrong? The following is what I have in my query:

Iam200: IIf([Category]=200,[Amount],0)

Thank you,
MN

Al Campagna said:
MacNut,
Well, the concept is the same for a subform, or a report.
I may have made a typo in my second reply... see below. I think I pasted some code
from my testing by mistake.

First, use a continuous subform, and in the Form Footer, place a field named
Total200Amounts (don't use a name that matches the name of any element in the
calculation), and give that a ControlSource of...
=Sum(IIF(Category = 200, [Amount], 0))
Amount can't be a calculated field itself, it should be a "bound" field.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


Also, I meant to say it was a subFORM, not report, if that makes any
difference with those errors.

Thanks!
MN

:

Mac,
Also, without the query calculated field... in any footer...
= Sum(IIF(Category = 200, 200, 0))

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Hello,

I have some fields in a subreport -- ID, category and amount, that I need to
total. For instance, I need a total of "amount" where each category is
"200", not including any other cateogry.

How do I do this? I Tried it, and it worked when there was only ONE RECORD
in that particular ID. If there was a category 200 and another record for
that ID that was 203, it's adding the amoutns for both categories together.
What am I doing wrong?

here is my if statement:
=IIf([Category]=200,Sum([Amount]),0)

Thank you!
MN
 
M

MacNut2004

Also, does it matter that "Category" is a combo box?

Al Campagna said:
MacNut,
Did you read my last post on 4/11 @ 12:24? Please do....

Please answer all...
Is Category a "bound" Numeric field, and is Category on the subform?
Is Amount a "bound" Numeric field, and *NOT* a calculated field (Like... Price * Qty =
Amount)
When you say you get an error, is it "#Error"

To simplify the matter, why don't we just try the Footer calculation. Remove the
IAm200 from the query, and we'll try to summ the 200 Amounts directly in the footer.
Again, Amount can not be a calculated field on the subform...

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."



MacNut2004 said:
Al,

I tried putting "Iam200" in the query behind the scenes and then the
sum(Iam200) in the form footer and i have an error in that calculated field
in the form. What am I doing wrong? The following is what I have in my query:

Iam200: IIf([Category]=200,[Amount],0)

Thank you,
MN

Al Campagna said:
MacNut,
Well, the concept is the same for a subform, or a report.
I may have made a typo in my second reply... see below. I think I pasted some code
from my testing by mistake.

First, use a continuous subform, and in the Form Footer, place a field named
Total200Amounts (don't use a name that matches the name of any element in the
calculation), and give that a ControlSource of...
=Sum(IIF(Category = 200, [Amount], 0))
Amount can't be a calculated field itself, it should be a "bound" field.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


Also, I meant to say it was a subFORM, not report, if that makes any
difference with those errors.

Thanks!
MN

:

Mac,
Also, without the query calculated field... in any footer...
= Sum(IIF(Category = 200, 200, 0))

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Hello,

I have some fields in a subreport -- ID, category and amount, that I need to
total. For instance, I need a total of "amount" where each category is
"200", not including any other cateogry.

How do I do this? I Tried it, and it worked when there was only ONE RECORD
in that particular ID. If there was a category 200 and another record for
that ID that was 203, it's adding the amoutns for both categories together.
What am I doing wrong?

here is my if statement:
=IIf([Category]=200,Sum([Amount]),0)

Thank you!
MN
 
A

Al Campagna

No, a combo value should work just as a text control, as long as you are storing the
proper value (200) in the bound field.

Why not just Zip and send me the file/s.
Use my web address below (contact), and be sure to include the word "newsgroups" in the
subject.
In the body of the email indicate what version of Access, and a description of what form
you are having problems with.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


MacNut2004 said:
Also, does it matter that "Category" is a combo box?

Al Campagna said:
MacNut,
Did you read my last post on 4/11 @ 12:24? Please do....

Please answer all...
Is Category a "bound" Numeric field, and is Category on the subform?
Is Amount a "bound" Numeric field, and *NOT* a calculated field (Like... Price * Qty
=
Amount)
When you say you get an error, is it "#Error"

To simplify the matter, why don't we just try the Footer calculation. Remove the
IAm200 from the query, and we'll try to summ the 200 Amounts directly in the footer.
Again, Amount can not be a calculated field on the subform...

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."



MacNut2004 said:
Al,

I tried putting "Iam200" in the query behind the scenes and then the
sum(Iam200) in the form footer and i have an error in that calculated field
in the form. What am I doing wrong? The following is what I have in my query:

Iam200: IIf([Category]=200,[Amount],0)

Thank you,
MN

:

MacNut,
Well, the concept is the same for a subform, or a report.
I may have made a typo in my second reply... see below. I think I pasted some
code
from my testing by mistake.

First, use a continuous subform, and in the Form Footer, place a field named
Total200Amounts (don't use a name that matches the name of any element in the
calculation), and give that a ControlSource of...
=Sum(IIF(Category = 200, [Amount], 0))
Amount can't be a calculated field itself, it should be a "bound" field.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


Also, I meant to say it was a subFORM, not report, if that makes any
difference with those errors.

Thanks!
MN

:

Mac,
Also, without the query calculated field... in any footer...
= Sum(IIF(Category = 200, 200, 0))

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Hello,

I have some fields in a subreport -- ID, category and amount, that I need to
total. For instance, I need a total of "amount" where each category is
"200", not including any other cateogry.

How do I do this? I Tried it, and it worked when there was only ONE RECORD
in that particular ID. If there was a category 200 and another record for
that ID that was 203, it's adding the amoutns for both categories together.
What am I doing wrong?

here is my if statement:
=IIf([Category]=200,Sum([Amount]),0)

Thank you!
MN
 
M

MacNut2004

Al,

I just took another look at my code and i have 2 calculated fields for those
codes -- if it's 200 i want the amount totaled and if it's 201 i want another
total. So when I looked at the code for the calculated field summing the 200
numbers, I noticed that I had misspelled "category." When I fixed that, it
fixed BOTH fields and it works properly now!! (so having one spelling error
in one field can mess up ALL those calculated total fields?) Very strange.

Thanks very much for your help!!!!
mN

Al Campagna said:
No, a combo value should work just as a text control, as long as you are storing the
proper value (200) in the bound field.

Why not just Zip and send me the file/s.
Use my web address below (contact), and be sure to include the word "newsgroups" in the
subject.
In the body of the email indicate what version of Access, and a description of what form
you are having problems with.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


MacNut2004 said:
Also, does it matter that "Category" is a combo box?

Al Campagna said:
MacNut,
Did you read my last post on 4/11 @ 12:24? Please do....

Please answer all...
Is Category a "bound" Numeric field, and is Category on the subform?
Is Amount a "bound" Numeric field, and *NOT* a calculated field (Like... Price * Qty
=
Amount)
When you say you get an error, is it "#Error"

To simplify the matter, why don't we just try the Footer calculation. Remove the
IAm200 from the query, and we'll try to summ the 200 Amounts directly in the footer.
Again, Amount can not be a calculated field on the subform...

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."



Al,

I tried putting "Iam200" in the query behind the scenes and then the
sum(Iam200) in the form footer and i have an error in that calculated field
in the form. What am I doing wrong? The following is what I have in my query:

Iam200: IIf([Category]=200,[Amount],0)

Thank you,
MN

:

MacNut,
Well, the concept is the same for a subform, or a report.
I may have made a typo in my second reply... see below. I think I pasted some
code
from my testing by mistake.

First, use a continuous subform, and in the Form Footer, place a field named
Total200Amounts (don't use a name that matches the name of any element in the
calculation), and give that a ControlSource of...
=Sum(IIF(Category = 200, [Amount], 0))
Amount can't be a calculated field itself, it should be a "bound" field.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


Also, I meant to say it was a subFORM, not report, if that makes any
difference with those errors.

Thanks!
MN

:

Mac,
Also, without the query calculated field... in any footer...
= Sum(IIF(Category = 200, 200, 0))

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Hello,

I have some fields in a subreport -- ID, category and amount, that I need to
total. For instance, I need a total of "amount" where each category is
"200", not including any other cateogry.

How do I do this? I Tried it, and it worked when there was only ONE RECORD
in that particular ID. If there was a category 200 and another record for
that ID that was 203, it's adding the amoutns for both categories together.
What am I doing wrong?

here is my if statement:
=IIf([Category]=200,Sum([Amount]),0)

Thank you!
MN
 
A

Al Campagna

MacNut,
That's very odd, because if you mispell an control name in a calculation, and the
calculation itself is OK, it should create a #Name error not a #Error error.
#Name indicates Access can't find an element of the calculation.
But, I won't argue with success...

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

MacNut2004 said:
Al,

I just took another look at my code and i have 2 calculated fields for those
codes -- if it's 200 i want the amount totaled and if it's 201 i want another
total. So when I looked at the code for the calculated field summing the 200
numbers, I noticed that I had misspelled "category." When I fixed that, it
fixed BOTH fields and it works properly now!! (so having one spelling error
in one field can mess up ALL those calculated total fields?) Very strange.

Thanks very much for your help!!!!
mN

Al Campagna said:
No, a combo value should work just as a text control, as long as you are storing the
proper value (200) in the bound field.

Why not just Zip and send me the file/s.
Use my web address below (contact), and be sure to include the word "newsgroups" in the
subject.
In the body of the email indicate what version of Access, and a description of what
form
you are having problems with.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


MacNut2004 said:
Also, does it matter that "Category" is a combo box?

:

MacNut,
Did you read my last post on 4/11 @ 12:24? Please do....

Please answer all...
Is Category a "bound" Numeric field, and is Category on the subform?
Is Amount a "bound" Numeric field, and *NOT* a calculated field (Like... Price *
Qty
=
Amount)
When you say you get an error, is it "#Error"

To simplify the matter, why don't we just try the Footer calculation. Remove the
IAm200 from the query, and we'll try to summ the 200 Amounts directly in the footer.
Again, Amount can not be a calculated field on the subform...

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."



Al,

I tried putting "Iam200" in the query behind the scenes and then the
sum(Iam200) in the form footer and i have an error in that calculated field
in the form. What am I doing wrong? The following is what I have in my query:

Iam200: IIf([Category]=200,[Amount],0)

Thank you,
MN

:

MacNut,
Well, the concept is the same for a subform, or a report.
I may have made a typo in my second reply... see below. I think I pasted some
code
from my testing by mistake.

First, use a continuous subform, and in the Form Footer, place a field named
Total200Amounts (don't use a name that matches the name of any element in the
calculation), and give that a ControlSource of...
=Sum(IIF(Category = 200, [Amount], 0))
Amount can't be a calculated field itself, it should be a "bound" field.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


Also, I meant to say it was a subFORM, not report, if that makes any
difference with those errors.

Thanks!
MN

:

Mac,
Also, without the query calculated field... in any footer...
= Sum(IIF(Category = 200, 200, 0))

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Hello,

I have some fields in a subreport -- ID, category and amount, that I need to
total. For instance, I need a total of "amount" where each category is
"200", not including any other cateogry.

How do I do this? I Tried it, and it worked when there was only ONE RECORD
in that particular ID. If there was a category 200 and another record for
that ID that was 203, it's adding the amoutns for both categories together.
What am I doing wrong?

here is my if statement:
=IIf([Category]=200,Sum([Amount]),0)

Thank you!
MN
 

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