A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

subtotals doubled if printing report after preview



 
 
Thread Tools Display Modes
  #1  
Old August 11th, 2004, 03:21 PM
Glenn
external usenet poster
 
Posts: n/a
Default subtotals doubled if printing report after preview

hi all,

as the subject states, my problem lies with incorrect subtotals on
report printed after they are previewed. (access 2000)

the subtotals are the result of a custom function

simplified report event description:

in: report_open

n_sum = 0

in: detail_print
n_sum = n_sum + f_calc_Sum(params)
'calc sum depends on diff. parameters - not straightforward sums

---------
this works fine if the report is directly printed. if previewed, and the
user is so kind to go throught every page incrementally, it is fine
also.

but if the report is printed after the user has previewed it, access
goes through every sum again. the result is doubled intermediate & end
sums.
--------
i've searched for a way to detect the print command and reset the
variable n_sum, but was unsuccesful.

searching on usenet showed many similar questions, but with no
convenient answers.
My report is too complex (and finally works to modify its structure
significantly (other queries/temp. tables and such)

I do not understand how the PrintCount parameter, suggested by some,
could help. the help states that it is reset each time a new section is
printed. so losing any link to a previous situation.

Now, my only real solution is to present the user a (hopefully) clear
warning not print after previewing.

come on, you can do better
glenn
  #2  
Old August 11th, 2004, 04:11 PM
Allen Browne
external usenet poster
 
Posts: n/a
Default subtotals doubled if printing report after preview

This kind of accumulation is not reliable. If the user previews page 1, and
jumps to page 4, the events may not fire for the intervening pages, and so
the results will be wrong.

Alternatives:
1. Use a Running Sum.

2. Create a query as the source for the report, and put your function into
the query as a calculated field.

If you want to go with your original idea anyway, move the line:
n_sum = 0
into the Format event of the Report Header, instead of the Open event of the
report. If you do not have a Report Header section, create one (View menu).

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Glenn" wrote in message
om...

as the subject states, my problem lies with incorrect subtotals on
report printed after they are previewed. (access 2000)

the subtotals are the result of a custom function

simplified report event description:

in: report_open

n_sum = 0

in: detail_print
n_sum = n_sum + f_calc_Sum(params)
'calc sum depends on diff. parameters - not straightforward sums

---------
this works fine if the report is directly printed. if previewed, and the
user is so kind to go throught every page incrementally, it is fine
also.

but if the report is printed after the user has previewed it, access
goes through every sum again. the result is doubled intermediate & end
sums.
--------
i've searched for a way to detect the print command and reset the
variable n_sum, but was unsuccesful.

searching on usenet showed many similar questions, but with no
convenient answers.
My report is too complex (and finally works to modify its structure
significantly (other queries/temp. tables and such)

I do not understand how the PrintCount parameter, suggested by some,
could help. the help states that it is reset each time a new section is
printed. so losing any link to a previous situation.

Now, my only real solution is to present the user a (hopefully) clear
warning not print after previewing.

come on, you can do better
glenn



  #4  
Old August 12th, 2004, 09:30 AM
Allen Browne
external usenet poster
 
Posts: n/a
Default subtotals doubled if printing report after preview

Report_Open fires once, when the report opens, before the data is retrieved.

The Format event of the Report Header fires when Access prepares a print or
preview. Since this is always the first section on a report, it is the one
to use to reset your accumulation variable.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Glenn" wrote in message
om...
The exact chain of events is not all that clear to me. I'll look into
that again (sigh).

thanks for your help
glenn



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2000 portrait print preview and printing ChiragV General Discussions 0 July 27th, 2004 06:02 PM
Preview Report in Form Craig Using Forms 1 June 23rd, 2004 03:57 PM
Label SRIT General Discussion 2 June 22nd, 2004 09:42 PM
I need a quick help with report printing Al Setting Up & Running Reports 7 June 3rd, 2004 06:02 PM
Help Printing a Report with Blank Fields Jen New Users 6 May 1st, 2004 02:32 PM


All times are GMT +1. The time now is 08:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.