calculate accumulated

  • Thread starter Thread starter Frank Dulk
  • Start date Start date
F

Frank Dulk

As I create a report with I calculate accumulated, where I calculate him/it
of the accumulated field it would be done in the event when formatting of
the report.
 
As I create a report with I calculate accumulated, where I calculate him/it
of the accumulated field it would be done in the event when formatting of
the report.

The simplest way to display an accumlated total on a Report is to set
the "Running Sum" property of the textbox bound to the field. No code
is needed.
 
The problem that that field has the total calculated in the event when
formatting of the report and when I change the property Running Sum for
group doesn't make I calculate correct.
 
Calculation in report event code is always problematical, because it is
impossible to determine beforehand how many times a given event will fire
for a given record. This is particularly a problem if you are in Report
Preview and paging forward and backward.

I strongly recommend you do your calculations in the query on which the
report is based, and using the builtin Sum (and other) functions in Footers,
or the Running Sum property. I realize that may take some redesign on your
part, but, believe me, it will be worth the time and effort to avoid
calculations in event code.

Larry Linson
Microsoft Access MVP
 
But the problem is that have to do that I calculate in the same report,
because one of the calculations I catch the total amount and I divide for
the total value
 
Would not have it unites function where I can store the previous value and
to go adding the other value?
 
The problem that that field has the total calculated in the event when
formatting of the report and when I change the property Running Sum for
group doesn't make I calculate correct.

If I'm understanding this correctly, you may have better luck by doing
the calculation in the report's recordsource Query rather than on the
Report itself.
 
I cannot calculate in the query, because one of the field depends of other I
calculate, that is only done in time of execution

example:

accumulated total / accumulated value
 
I cannot calculate in the query, because one of the field depends of other I
calculate, that is only done in time of execution

example:

accumulated total / accumulated value

Without knowing the details of the table, I can't be certain; but it
sounds like an expression like

DSum("[field]", "[tablename]", "<some criteria>") / DSum("[field]",
"[tablename]", "<some different criteria>")

should work.
 
But I need that the result of that division is the value of SALE of the
product


John Vinson said:
I cannot calculate in the query, because one of the field depends of other I
calculate, that is only done in time of execution

example:

accumulated total / accumulated value

Without knowing the details of the table, I can't be certain; but it
sounds like an expression like

DSum("[field]", "[tablename]", "<some criteria>") / DSum("[field]",
"[tablename]", "<some different criteria>")

should work.
 
But I need that the result of that division is the value of SALE of the
product

Fine; then use a DSum() which calculates what you want.

YOU can see your database; I cannot. You know what you're trying to
calculate; I do not.
 
everything calculated I just want a way to change the value of the result
accumulated Value / accumulated Amount of purchase and to place as the value
of sale of the product.

But everything well knows that it is difficult to understand without this
see, I will try to uncoil here.

Thank you very much
 
Back
Top