Report Calculation

S

Stockwell43

Hello,

I have a form that has three fields: Type1, Type2, Type3. I have an unbound
text box to total the number from these three fields and this is what I am
using: =Nz([Type1])+NZ([Type2])+NZ([Type3]) and it works fine. On the report
I placed an unbound text box in the details section to total each day's
Type1, Type2 and Type3 and that works fine using the same forumla. However, I
am trying to sum the total Type1, Type2 and Type3 for the whole report and am
unable to do this. Am I using the worng formula to begin with??

Thanks!!
 
A

Allen Browne

Try one of these:
=Sum(Nz([Type1],0) + NZ([Type2],0)+NZ([Type3],0))
=Nz(Sum([Type1]),0) + Nz(Sum([Type2]),0) + Nz(Sum([Type3]),0)

Presumably you understand that repeating fields (like Type1, Type2, Type3)
violate basic normalization rules (if your table structure is like that.)
 
S

Stockwell43

Hi Allen, thank you responding.

Well, I have Type1,2 and 3 in the table but not saving the calculation in
the table. I don't mean to sound dense but am I suppose to have something in
the query?

On the report, the manager wants to see each day with the number of Type1, 2
and 3 and the total for the day (that's the formula I used in the detail
section). Then, they want to see the total for the entire report which is
what I am trying to do in the report footer section. (just to give you a
better picture of what I am doing).

The code you gave me came up with the following errors:

First Code:

Extra) in query expression 'First([=Sum(Nz([Type1],0) +
NZ([Type2],0)+NZ([Type3],0)) So I took off the last ) and it told me I am
missing a closed parenthesis, bracket or vertical bar.

Second Code:

Syntax error (comma) in query expression 'First=Nz(Sum([Type1]),0) +
Nz(Sum([Type2]),0) + Nz(Sum([Type3]),0)

Allen, if I am not doing this correctly, please tell me what I am doing
wrong. I thought I would be a simple thing to add the numbers but I never did
this before adding three fields together.

Thank you for your help!!!


Allen Browne said:
Try one of these:
=Sum(Nz([Type1],0) + NZ([Type2],0)+NZ([Type3],0))
=Nz(Sum([Type1]),0) + Nz(Sum([Type2]),0) + Nz(Sum([Type3]),0)

Presumably you understand that repeating fields (like Type1, Type2, Type3)
violate basic normalization rules (if your table structure is like that.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Stockwell43 said:
I have a form that has three fields: Type1, Type2, Type3. I have an
unbound
text box to total the number from these three fields and this is what I am
using: =Nz([Type1])+NZ([Type2])+NZ([Type3]) and it works fine. On the
report
I placed an unbound text box in the details section to total each day's
Type1, Type2 and Type3 and that works fine using the same forumla.
However, I
am trying to sum the total Type1, Type2 and Type3 for the whole report and
am
unable to do this. Am I using the worng formula to begin with??

Thanks!!
 
A

Allen Browne

I did assume that you were doing this in a report?
If so, I'm not sure where the 'FIRST' part comes in.

Regarding the table, whereever you see repeating fields (Type1, Type2, etc,)
it always means that you need a related table where there can be many
records, instead of many repeating fields in this table. Whatever it is that
can have 3 (or more? or fewer?) types, it would be better modelled with a
one-to-many relationship.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Stockwell43 said:
Hi Allen, thank you responding.

Well, I have Type1,2 and 3 in the table but not saving the calculation in
the table. I don't mean to sound dense but am I suppose to have something
in
the query?

On the report, the manager wants to see each day with the number of Type1,
2
and 3 and the total for the day (that's the formula I used in the detail
section). Then, they want to see the total for the entire report which is
what I am trying to do in the report footer section. (just to give you a
better picture of what I am doing).

The code you gave me came up with the following errors:

First Code:

Extra) in query expression 'First([=Sum(Nz([Type1],0) +
NZ([Type2],0)+NZ([Type3],0)) So I took off the last ) and it told me I am
missing a closed parenthesis, bracket or vertical bar.

Second Code:

Syntax error (comma) in query expression 'First=Nz(Sum([Type1]),0) +
Nz(Sum([Type2]),0) + Nz(Sum([Type3]),0)

Allen, if I am not doing this correctly, please tell me what I am doing
wrong. I thought I would be a simple thing to add the numbers but I never
did
this before adding three fields together.

Thank you for your help!!!


Allen Browne said:
Try one of these:
=Sum(Nz([Type1],0) + NZ([Type2],0)+NZ([Type3],0))
=Nz(Sum([Type1]),0) + Nz(Sum([Type2]),0) + Nz(Sum([Type3]),0)

Presumably you understand that repeating fields (like Type1, Type2,
Type3)
violate basic normalization rules (if your table structure is like that.)

Stockwell43 said:
I have a form that has three fields: Type1, Type2, Type3. I have an
unbound
text box to total the number from these three fields and this is what I
am
using: =Nz([Type1])+NZ([Type2])+NZ([Type3]) and it works fine. On the
report
I placed an unbound text box in the details section to total each day's
Type1, Type2 and Type3 and that works fine using the same forumla.
However, I
am trying to sum the total Type1, Type2 and Type3 for the whole report
and
am
unable to do this. Am I using the worng formula to begin with??

Thanks!!
 
S

Stockwell43

Correct, it is in the report.

Should I change the field names to RealEstate, Commercial and Auto?

How come my forumla works for totaling each day but not the whole report?

Allen Browne said:
I did assume that you were doing this in a report?
If so, I'm not sure where the 'FIRST' part comes in.

Regarding the table, whereever you see repeating fields (Type1, Type2, etc,)
it always means that you need a related table where there can be many
records, instead of many repeating fields in this table. Whatever it is that
can have 3 (or more? or fewer?) types, it would be better modelled with a
one-to-many relationship.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Stockwell43 said:
Hi Allen, thank you responding.

Well, I have Type1,2 and 3 in the table but not saving the calculation in
the table. I don't mean to sound dense but am I suppose to have something
in
the query?

On the report, the manager wants to see each day with the number of Type1,
2
and 3 and the total for the day (that's the formula I used in the detail
section). Then, they want to see the total for the entire report which is
what I am trying to do in the report footer section. (just to give you a
better picture of what I am doing).

The code you gave me came up with the following errors:

First Code:

Extra) in query expression 'First([=Sum(Nz([Type1],0) +
NZ([Type2],0)+NZ([Type3],0)) So I took off the last ) and it told me I am
missing a closed parenthesis, bracket or vertical bar.

Second Code:

Syntax error (comma) in query expression 'First=Nz(Sum([Type1]),0) +
Nz(Sum([Type2]),0) + Nz(Sum([Type3]),0)

Allen, if I am not doing this correctly, please tell me what I am doing
wrong. I thought I would be a simple thing to add the numbers but I never
did
this before adding three fields together.

Thank you for your help!!!


Allen Browne said:
Try one of these:
=Sum(Nz([Type1],0) + NZ([Type2],0)+NZ([Type3],0))
=Nz(Sum([Type1]),0) + Nz(Sum([Type2]),0) + Nz(Sum([Type3]),0)

Presumably you understand that repeating fields (like Type1, Type2,
Type3)
violate basic normalization rules (if your table structure is like that.)


I have a form that has three fields: Type1, Type2, Type3. I have an
unbound
text box to total the number from these three fields and this is what I
am
using: =Nz([Type1])+NZ([Type2])+NZ([Type3]) and it works fine. On the
report
I placed an unbound text box in the details section to total each day's
Type1, Type2 and Type3 and that works fine using the same forumla.
However, I
am trying to sum the total Type1, Type2 and Type3 for the whole report
and
am
unable to do this. Am I using the worng formula to begin with??

Thanks!!
 
S

Stockwell43

I got it. This seemed to work:

=Sum(Nz([Type1])+NZ([Type2])+NZ([Type3]))

Thank you for help Allen, as always it's most appreciated!!!

Allen Browne said:
I did assume that you were doing this in a report?
If so, I'm not sure where the 'FIRST' part comes in.

Regarding the table, whereever you see repeating fields (Type1, Type2, etc,)
it always means that you need a related table where there can be many
records, instead of many repeating fields in this table. Whatever it is that
can have 3 (or more? or fewer?) types, it would be better modelled with a
one-to-many relationship.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Stockwell43 said:
Hi Allen, thank you responding.

Well, I have Type1,2 and 3 in the table but not saving the calculation in
the table. I don't mean to sound dense but am I suppose to have something
in
the query?

On the report, the manager wants to see each day with the number of Type1,
2
and 3 and the total for the day (that's the formula I used in the detail
section). Then, they want to see the total for the entire report which is
what I am trying to do in the report footer section. (just to give you a
better picture of what I am doing).

The code you gave me came up with the following errors:

First Code:

Extra) in query expression 'First([=Sum(Nz([Type1],0) +
NZ([Type2],0)+NZ([Type3],0)) So I took off the last ) and it told me I am
missing a closed parenthesis, bracket or vertical bar.

Second Code:

Syntax error (comma) in query expression 'First=Nz(Sum([Type1]),0) +
Nz(Sum([Type2]),0) + Nz(Sum([Type3]),0)

Allen, if I am not doing this correctly, please tell me what I am doing
wrong. I thought I would be a simple thing to add the numbers but I never
did
this before adding three fields together.

Thank you for your help!!!


Allen Browne said:
Try one of these:
=Sum(Nz([Type1],0) + NZ([Type2],0)+NZ([Type3],0))
=Nz(Sum([Type1]),0) + Nz(Sum([Type2]),0) + Nz(Sum([Type3]),0)

Presumably you understand that repeating fields (like Type1, Type2,
Type3)
violate basic normalization rules (if your table structure is like that.)


I have a form that has three fields: Type1, Type2, Type3. I have an
unbound
text box to total the number from these three fields and this is what I
am
using: =Nz([Type1])+NZ([Type2])+NZ([Type3]) and it works fine. On the
report
I placed an unbound text box in the details section to total each day's
Type1, Type2 and Type3 and that works fine using the same forumla.
However, I
am trying to sum the total Type1, Type2 and Type3 for the whole report
and
am
unable to do this. Am I using the worng formula to begin with??

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