Solved

MS Access double total when printing

Posted on 2014-10-21
6
340 Views
Last Modified: 2014-10-21
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
Comment
Question by:nancytherrien
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 37

Expert Comment

by:PatHartman
ID: 40395259
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
 

Author Comment

by:nancytherrien
ID: 40395295
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
 
LVL 37

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40395347
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
Independent Software Vendors: 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!

 

Author Comment

by:nancytherrien
ID: 40395505
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
 

Author Closing Comment

by:nancytherrien
ID: 40395507
thanks for fast reply.  solution is working just great !
0
 
LVL 37

Expert Comment

by:PatHartman
ID: 40395556
Glad it worked for you.  Been there, done that.  But I remembered the solution:)
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question