473,386 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Incrementing a Counter in a Subreport - Initializes on Next Page

Hi,

I use a counter in a subreport. The subreport is the primary data presentation for the report, and it covers more than 1 page.

I use the OnFormat event of the Detail section to conditionally initialize the counter.
I use the Onprint event of the Detail to increment the counter.

The problem is, that the counter seems to initialize itself when the report is pushed to a new page. The response is different if I have the "Keep Together" property set to "Yes" versus set to "No".

Ideally, I want this increment logic in OnFormat and OnPrint to behave the same from one page of the report to the next.

Can anybody help me?

Thanks!
Jun 3 '08 #1
2 1938
Stewart Ross
2,545 Expert Mod 2GB
If a section spills over more than one page that section's Format event is bound to occur more than once, as a separate event for each page (possibly also involving the use of the Retreat event as it goes from one page to the next) After all, the first page is formatted before it is printed, and if a section spills onto the next page the report generator must start again in formatting the new page with any header etc before formatting the spillover section.

In setting up just one page the format event may potentially occur several times, which is why there is a FormatCount value passed to the Format event handler.

It seems to me that using On Format of the detail section to initialise your counter is not going to help you, because by its nature it can occur more than once for the same subreport.

What can help you is the use of a group header placed immediately before your subreport, even if this group header comprises just a single line as a separator. You can use the On Print event of the header to initialise your variable, as the header will not recur until after you have printed your subreport, even if the subreport spills onto another page.

-Stewart
Jun 3 '08 #2
Thanks Stewart!

I've changed my approach to exclusively use the "On Print" event in the sub-report. Currently, I've found no condition where that doesn't work on my reporting.

Your response was very helpful. Thanks!

Nick
Jun 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Mike Brearley | last post by:
I have a counter (alright one I found on asp101.com) that checks for a session variable to prevent the counter from incrmenting if a user refreshes the page or returns to the page during the same...
8
by: dixie | last post by:
I have a report with a subreport. The source object for this subreport varies according to the value of a field in a table. I am trying to programmatically set the object source for the subreport...
1
by: last Name | last post by:
Hello all, I'm using Access 2000. I have a subreport control which loads a report in the detail section of a main report. I need to keep a count of each item price in the subreport and place it...
7
by: Ellen Manning | last post by:
I've got an A2K report showing students and their costs. Student info is in the main report and costs are in a subreport for each student. The user inputs the program desired then only those...
1
by: Kirsty Ryder | last post by:
Hi, I have a Report with a subreport, and I want to assign a value to the control source of a control on the subreport depending on the value given by the user in a separate form. Based on...
6
by: Steve Jorgensen | last post by:
I tried to fix a problem for a client today in which report sections and even individual text controls in some of their reports are being split across page boundaries. Of course, I was thinking...
0
by: Johnny M | last post by:
I have a main report that consists of 15 subreports. When a main detail item is produced only selected subreports are produced depending on a certain control. The subreports generally occupy only 3...
17
by: =?Utf-8?B?SGVyYg==?= | last post by:
I have created a report and subreport in VB/ASP.NET. The report works fine but the subreport will not display. The subreport, when displayed as a standalone report, works fine. Any help I can...
0
by: youngac | last post by:
I created a report containing a subreport on an XP Pro machine running Access 2003 (using 2000 format for the database) . It is a student report card. The main report contains the student name etc....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.