|
| |
|
|
pd_it_guy
Posts: 193 Joined: 3/4/2008 Status: offline
|
finding the end of data - 6/16/2008 21:08:19
Latest project is a web based Access database that prints out form letters made up from the data in the DB. At the end of each pass through the data group to be printed, there is a page eject command, so each letter comes out of the printer on a new page. Unfortunately at the last pass through, this causes a blank page to be printed out. Is there something that I can add to test and see if I am already at the end so I can skip over this page eject command and just let it come to a smooth stop. All ideas appreciated.
|
|
|
|
ou812
Posts: 1603 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: finding the end of data - 6/20/2008 20:05:37
Would it be possible to eject a page at the beginning instead? That way all you need to do is not print the blank page the first time through. Otherwise, you would probably need to read ahead to see if more data is coming prior to printing the last batch to know whether or not to print the blank page. More db intensive... but not sure how big this is etc. How are you reading records now to print?
_____________________________
-brian EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
|
|
pd_it_guy
Posts: 193 Joined: 3/4/2008 Status: offline
|
RE: finding the end of data - 6/21/2008 10:08:44
Thanks for the reply. The way it works is, we run a SELECT against the DB, and in the results section, make up a letter using various elements of the retrieved data. Exactly like a mail-merge document. All of this scrolls across the browser sereen to the user, and then you can print it out. With every row of selected data you of course get a new letter, one appended to the end of the other until you run out of data. It cycles through all the records. This requires a page break so individual letters came out of the printer. The problem is, how to not have that last page break, when we have already run out of data and it would have stopped anyway. You either have to skip the first one, if it at the head of the file, or the last one, if it is at end of the file, so we have to be able to reliably test for the either the beginning or end of file. The EOF function looked promising, but never worked, so I dont think it applies here. We tried doing the page eject command at the beginning of the data read section, (right after the second include file) but all that did is have the sheet of wasted paper happen at the start, not the end. I also tried having a counter cycle with each pass through the results section, so we don't issue a new page the very first time through, but that, too, has been un-successful. Was (am) hoping someone had done this kind of operation before and had an idea.
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: finding the end of data - 6/22/2008 13:45:13
quote:
We tried doing the page eject command at the beginning of the data read section, (right after the second include file) but all that did is have the sheet of wasted paper happen at the start, not the end. How about setting a flag with it and reset after the first pagebreak iteration? I think that's what Brian was referring to. Something like: (before the loop) Dim myFlag myFlag= 0 (at the beginning of the loop) .... If myFlag = 1 Then 'write Pagebreak code here End If myFlag = 1 .... That help any?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
pd_it_guy
Posts: 193 Joined: 3/4/2008 Status: offline
|
RE: finding the end of data - 6/22/2008 16:48:14
I think we tried that, and it did not work, but from what you just said, we may have miscalculated where the virtual DB loop starts and stops. This is essentialized code. We thought the virtual loop began AFTER the second include file, and ran to just inside the last include file. Or, is it earlier- like right after the Query Block. Clearly, I need to do my dimension and initialize outside, but keep the counter and page eject inside. Thanks for checking in on a Sunday. I may not get to try this out for a day or two but I will, and report back.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|