OnPrint event does not execute in between page.

P

pgm2000

Hi

I have an Access program with report which using unbound field
for the Total grouping
I put the calculation in the OnPrint event in the Group Footer
Let says I generated a report with 3 pages on a Print Preview mode
On the screen, I click to go to the last page (skipping page 2)

When I looked at the Group total at the end of the page (page3)
the total summation does not include group total on page 2

BUT, if I click page by page (1,2..3) to the last page, the total a
the
last page added up correctly

This strange problem only occured in MSAccess 2000. When I run th
same program on MSAccess 2003, it was ok

Would appreciate if someone could advice on this

Thanks a lot. :wink
 
M

Marshall Barton

pgm2000 said:
I have an Access program with report which using unbound fields
for the Total grouping.
I put the calculation in the OnPrint event in the Group Footer.
Let says I generated a report with 3 pages on a Print Preview mode.
On the screen, I click to go to the last page (skipping page 2).

When I looked at the Group total at the end of the page (page3),
the total summation does not include group total on page 2.

BUT, if I click page by page (1,2..3) to the last page, the total at
the
last page added up correctly.

This strange problem only occured in MSAccess 2000. When I run the
same program on MSAccess 2003, it was ok.


You can not reliably calculate a total using code in event
procedures. The various sections in a report are processed
in a non-sequential order and possibly multiple times as
needed to meet your use of KeepTogether, CanGrow, etc.

You will have to find another way to calculate the totals.
Maybe you can us one or more RunningSum text boxes instead?
 
P

pgm2000

Marshall Bartonwrote
pgm2000 wrote
You can not reliably calculate a total using code in even
procedures. The various sections in a report are processe
in a non-sequential order and possibly multiple times a
needed to meet your use of KeepTogether, CanGrow, etc

You will have to find another way to calculate the totals
Maybe you can us one or more RunningSum text boxes instead

Thanks for the reply Marsh. :)
The report that I'm doing contain too many fields. I'm using th
=Sum[fieldxx] in the ControlSource for the group total
As there are too many fields and grouping, I encountered "too man
fields defined" error. Therefore for one of the group total
I use Unbound fields and did the summation in one of the Onprin
event
Its working fine in Access 2003 but not 2000. Strange???

I did tried the DSum too but it took longer time

Well, looks like I have to try another method. :
 
M

Marshall Barton

Marshall Bartonwrote:
pgm2000 said:
Thanks for the reply Marsh. :)
The report that I'm doing contain too many fields. I'm using the
=Sum[fieldxx] in the ControlSource for the group total.
As there are too many fields and grouping, I encountered "too many
fields defined" error. Therefore for one of the group total,
I use Unbound fields and did the summation in one of the Onprint
event.
Its working fine in Access 2003 but not 2000. Strange???

I did tried the DSum too but it took longer time.

Well, looks like I have to try another method. :(


I am not familiar with a too many fields error in a report.
I suppose that if you had a couple of hundred fields in the
report's record source query, then adding a substantial
number of =Sum(... text boxes could push the report's
internally generated query over the limit of 256 fields.

OTOH, I have never seen a report with that many fields that
was readable. Maybe you can get rid of a bunch of less
important fields or move them to a subreport??
 
P

pgm2000

Yeah, too many =Sum() in the text boxes. Thats why
Good idea on the subreport
Will try that out

Thanks Marsh :wink
 

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