Sum in report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everyone. I could not find an answer that works for me, but maybe I do
not know what I need. On my report I have a text box called 'Total' with the
following as the control source.
=IIf([txtF1_F2].[Value]="F1",[txtf1burmdujan].[Value],[txtMDUBur].[Value])
The result of this statement is a numeric value. The problem is that I need
another box on my report header to sum the value of all the 'Total' boxes.
Can I do this in the report?
 
Ok, now I saw a post by Allen Browne saying you can not sum calculated
fields, but that I might be able to do it if I somehow use the same iif
statement again in the sum text box. Does anyone know how I would do this?
I tried to enter it this way, but it did not work:
=Sum(=IIf([txtF1_F2].[Value]="F1",[txtf1burmdujan].[Value],[txtMDUBur].[Value]))
 
You can't sum controls. You can sum expressions based on fields from your
report's record source.
 
Most naming conventions suggest that "txt..." might be text box controls. If
this is true, your Sum() will never work. You would need to use expressions
based on fields from your report's record source.

--
Duane Hookom
MS Access MVP
--

Greg Snidow said:
Ok, now I saw a post by Allen Browne saying you can not sum calculated
fields, but that I might be able to do it if I somehow use the same iif
statement again in the sum text box. Does anyone know how I would do
this?
I tried to enter it this way, but it did not work:
=Sum(=IIf([txtF1_F2].[Value]="F1",[txtf1burmdujan].[Value],[txtMDUBur].[Value]))

Greg Snidow said:
Hello everyone. I could not find an answer that works for me, but maybe
I do
not know what I need. On my report I have a text box called 'Total' with
the
following as the control source.

=IIf([txtF1_F2].[Value]="F1",[txtf1burmdujan].[Value],[txtMDUBur].[Value])
The result of this statement is a numeric value. The problem is that I
need
another box on my report header to sum the value of all the 'Total'
boxes.
Can I do this in the report?
 
Thanks Duane. That is what I was affraid of. My problem is that I am using
SQL 2K as my back end with an ADP front end. I have learned that iif
statements do not work with SQL, but they still work in my report. Do you
know how I would write the case statement to work in the SQL view, and if so
how I would enter it? And you are correct, the 'txt*' refers to unbound text
boxes on my report into which I was trying to sum the result of my expression.

Duane Hookom said:
Most naming conventions suggest that "txt..." might be text box controls. If
this is true, your Sum() will never work. You would need to use expressions
based on fields from your report's record source.

--
Duane Hookom
MS Access MVP
--

Greg Snidow said:
Ok, now I saw a post by Allen Browne saying you can not sum calculated
fields, but that I might be able to do it if I somehow use the same iif
statement again in the sum text box. Does anyone know how I would do
this?
I tried to enter it this way, but it did not work:
=Sum(=IIf([txtF1_F2].[Value]="F1",[txtf1burmdujan].[Value],[txtMDUBur].[Value]))

Greg Snidow said:
Hello everyone. I could not find an answer that works for me, but maybe
I do
not know what I need. On my report I have a text box called 'Total' with
the
following as the control source.

=IIf([txtF1_F2].[Value]="F1",[txtf1burmdujan].[Value],[txtMDUBur].[Value])
The result of this statement is a numeric value. The problem is that I
need
another box on my report header to sum the value of all the 'Total'
boxes.
Can I do this in the report?
 
You can use Case When syntax in SQL Server which is similar to IIf(). Check
Books-on-line for specifics or come back here (or a SQL Server ng) with you
requirements.

--
Duane Hookom
MS Access MVP
--

Greg Snidow said:
Thanks Duane. That is what I was affraid of. My problem is that I am
using
SQL 2K as my back end with an ADP front end. I have learned that iif
statements do not work with SQL, but they still work in my report. Do you
know how I would write the case statement to work in the SQL view, and if
so
how I would enter it? And you are correct, the 'txt*' refers to unbound
text
boxes on my report into which I was trying to sum the result of my
expression.

Duane Hookom said:
Most naming conventions suggest that "txt..." might be text box controls.
If
this is true, your Sum() will never work. You would need to use
expressions
based on fields from your report's record source.

--
Duane Hookom
MS Access MVP
--

Greg Snidow said:
Ok, now I saw a post by Allen Browne saying you can not sum calculated
fields, but that I might be able to do it if I somehow use the same iif
statement again in the sum text box. Does anyone know how I would do
this?
I tried to enter it this way, but it did not work:
=Sum(=IIf([txtF1_F2].[Value]="F1",[txtf1burmdujan].[Value],[txtMDUBur].[Value]))

:

Hello everyone. I could not find an answer that works for me, but
maybe
I do
not know what I need. On my report I have a text box called 'Total'
with
the
following as the control source.

=IIf([txtF1_F2].[Value]="F1",[txtf1burmdujan].[Value],[txtMDUBur].[Value])
The result of this statement is a numeric value. The problem is that
I
need
another box on my report header to sum the value of all the 'Total'
boxes.
Can I do this in the report?
 
Back
Top