Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

MS Access double total when printing

Good afternoon,
I have a problem in the fact that in my BDAccess I have a report create that sum the amount of time.
 This is working fine when I see the report on screen, but when I hit print after it has been look as preview, the Total hours have been double.  The rest of the report is still good, just the total. If I asked it to print without preview, the total is good.

I have searched a couple of days the reason why but I don't find anything.
Maybe you can help me please.

Thanks
code-print-total.txt
0
Nancy Therrien
Asked:
Nancy Therrien
  • 3
  • 3
1 Solution
 
PatHartmanCommented:
You need to reset the accumulator.  It  accumulates the hours during the preview and then again when Access reruns the report to print it.

Is there some reason you are using code rather than functions to sum the hours.  In the section/report footer, you can add a control with the following control source to sum the data.

=Sum(yourhoursfield)
0
 
Nancy TherrienTI Tech and NetworkAuthor Commented:
hello PatHartman,

how do I reset the accumulator ?

The reason I'm doing it by code is that I have to separate mill from office hours and some hours are taken in R et D and some not.

Thanks,
0
 
PatHartmanCommented:
You could probably do what you need to do with expressions as ControlSources but for now, try setting the accumulator to 0 in the print event of the report footer.  You don't actually need to have any controls in the section.  That zeros out the accumulator at the end of the process so it is initialized if the process reruns.  Or, you could use the on format event of the report header and set it to zero at the start of the process.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Nancy TherrienTI Tech and NetworkAuthor Commented:
Oh ! my god you are too good.  Thanks I have putted in header print event the txt=0 and it is working.

Thanks a lot.

Nancy
0
 
Nancy TherrienTI Tech and NetworkAuthor Commented:
thanks for fast reply.  solution is working just great !
0
 
PatHartmanCommented:
Glad it worked for you.  Been there, done that.  But I remembered the solution:)
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now