Printed Totals are Doubled

G

Guest

I have calculated totals in a report (using VBA). When I preview the report
the totals are correct. When I print the report they are doubled in the
report footer. I know that Access recalculates totals but what do I have to
change so that the totals are not doubled when the report is actually printed?
 
F

fredg

I have calculated totals in a report (using VBA). When I preview the report
the totals are correct. When I print the report they are doubled in the
report footer. I know that Access recalculates totals but what do I have to
change so that the totals are not doubled when the report is actually printed?

Set those controls to Zero in the Report Header Format event.
Me![ControlName] = 0

You would be much better off doing all of your calculations in unbound
controls in the Report's Detail Section.

Sometimes, doing math in VBA, if the section has to be re-formatted
before printing (by Access because the data won't fit in the section),
Access will not undo the calculation automatically. You'll need to
code it to do so in the section's Retreat event. There is an example
of this (if I remember correctly) in the Solutions.mdb sample database
that ships with Access.
 
G

Guest

Thanks, that solved my issue

fredg said:
I have calculated totals in a report (using VBA). When I preview the report
the totals are correct. When I print the report they are doubled in the
report footer. I know that Access recalculates totals but what do I have to
change so that the totals are not doubled when the report is actually printed?

Set those controls to Zero in the Report Header Format event.
Me![ControlName] = 0

You would be much better off doing all of your calculations in unbound
controls in the Report's Detail Section.

Sometimes, doing math in VBA, if the section has to be re-formatted
before printing (by Access because the data won't fit in the section),
Access will not undo the calculation automatically. You'll need to
code it to do so in the section's Retreat event. There is an example
of this (if I remember correctly) in the Solutions.mdb sample database
that ships with Access.
 
M

Marshall Barton

Resetting the variable may have solved it for the moment,
but keep Fred's advice in mind when you make some innocuous
change to the report and the calculation doesn't work again.
--
Marsh
MVP [MS Access]


Dan said:
Thanks, that solved my issue

fredg said:
I have calculated totals in a report (using VBA). When I preview the report
the totals are correct. When I print the report they are doubled in the
report footer. I know that Access recalculates totals but what do I have to
change so that the totals are not doubled when the report is actually printed?

Set those controls to Zero in the Report Header Format event.
Me![ControlName] = 0

You would be much better off doing all of your calculations in unbound
controls in the Report's Detail Section.

Sometimes, doing math in VBA, if the section has to be re-formatted
before printing (by Access because the data won't fit in the section),
Access will not undo the calculation automatically. You'll need to
code it to do so in the section's Retreat event. There is an example
of this (if I remember correctly) in the Solutions.mdb sample database
that ships with Access.
 

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