Solved

How to suppress the last blank page within the Crystal report in VB.NET?

Posted on 2009-03-30
20
3,870 Views
Last Modified: 2012-05-06
The VB.NET crystal report does not have the option of "Suppress Print if no records", while the regular crystal report 9.0 has this option.
I placed a subreport in a group footer section, the report is grouped by date and I set the new page after the date changes. The last blank page always prints out after the subreport dispays. Ive also tried using the null counter to suppress the subreport and the group footer section, but it still does not work. Please help!
0
Comment
Question by:LucyRRD
  • 9
  • 7
  • 4
20 Comments
 
LVL 34

Expert Comment

by:James0628
ID: 24025060
I'm not entirely sure what you're trying to do, because you talk about a new page after the subreport and trying to suppress the last blank page and trying to suppress the subreport.

 If you're trying to keep CR from doing the "new page after" at the very end of the report, try going to that section, unchecking the "new page after" option, clicking on the formula (X+2) button beside "new page after" and putting in

not OnLastRecord

 That should tell CR to not do the "new page after" when it is on the last record (ie. at the very end).

 James
0
 

Author Comment

by:LucyRRD
ID: 24025232
James,

I've tried using 'not OnLastRecord' as you suggested. It still does not work.
What I'm trying to do is to suppress the blank last page. I have a main report and a subreport at the group footer section.

 If I totally suppress the group footer section that contains the subreport (for testing purposes), I won't get any blank report. If I just suppress the subreport itself (for testing purposes) without suppressing the group footer, I still get the blank page. It seems the "Suppress blank section" within the group footer section does not work.

Regards,
Lucy
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 24025607
Make sure the subreport and any fields in the group footer aren't too wide for the main report.

mlmcc
0
 
LVL 34

Expert Comment

by:James0628
ID: 24035154
So, if you suppress the subreport (as you said, for testing purposes) and use "suppress blank section" on the group footer, you still get the extra page?

 James
0
 

Author Comment

by:LucyRRD
ID: 24039235
Yes, James.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 24040964
Sounds like there is a field behind the subreport that is too wide

mlmcc
0
 

Author Comment

by:LucyRRD
ID: 24041160
I've checked there is no extra field behind the subreport.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 24041469
Is this happening on the development machine?

mlmcc
0
 

Author Comment

by:LucyRRD
ID: 24042291
Yes, it is on the development machine.
0
 
LVL 34

Accepted Solution

by:
James0628 earned 500 total points
ID: 24045534
FWIW, "not OnLastRecord" (without the quotes, of course) can work for this kind of thing, but it depends on your data and the structure of your report.

 Another thing you could try would be unchecking "new page after" and entering a formula like:

PageNumber <> TotalPageCount - 1

 You may need to change the right side (eg. leave off the "- 1" or use "- 2").  To be honest, I think that that's kind of a longshot, but it's easy enough to try.

 Otherwise, it might help if we could see the report.  You could attach it to a post here.  Just change the extension to one of the types that EE accepts, like TXT.

 James
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:LucyRRD
ID: 24050470
James,

I've tried the formula: PageNumber <> TotalPageCount - 1, it adds more blank pages to the report.

Regards,
Lucy


0
 
LVL 100

Expert Comment

by:mlmcc
ID: 24053172
Can you upload the report?

Make a copy and change the extension to TXT

mlmcc
0
 

Author Comment

by:LucyRRD
ID: 24054446
Sorry, I can not upload the file due to the company policy. Thanks for your help!


0
 
LVL 34

Expert Comment

by:James0628
ID: 24055844
You accepted my post as the solution.  Did the PageNumber <> TotalPageCount thing work for you after all?

 James
0
 

Author Comment

by:LucyRRD
ID: 24059931
James,

Thanks for your help. Neither "not OnLastRecord", nor PageNumber <> TotalPageCount work. I think you are right, it's the data issue. The report prints a blank sheet only when the last day of the report date range does not have any data. Do you have any other suggestions to get rid of the last blank page?

Regards,
Lucy
0
 
LVL 34

Expert Comment

by:James0628
ID: 24065578
Well, first of all, if my suggestions didn't help, you certainly don't need to accept that post as the solution.  And once you accept a solution, you're not likely to get any more suggestions (although I've been known to do that :-).  If we ultimately find no solution, you can ask to have your points refunded.

 > The report prints a blank sheet only when the last day
 > of the report date range does not have any data.

 You said that you're grouping by date.  Is that for each day?  If a day actually does not have any records, I wouldn't expect it to show up at all on the report, much less give you a group footer that adds an unwanted blank page.  IOW, I'm not sure I'm following you there.  Is the report using the date range in the record selection (which would completely eliminate any records outside that range from the report), or is it using suppression?

 James
0
 

Author Comment

by:LucyRRD
ID: 24077179
James,

My main report left-out-joins a Calendar file and is grouped by the date from the Calendar file. The report then calls the subreport at the group footer section and passes the date parameter to the subreport to get data from a different file.

The reason I'm doing this is that certain days only load the data from the subreport, while the main report is blank. I'm using the suppression of the blank subreport.

Note: The main report is very complicated and contains another subreport.

Regards,
Lucy

0
 
LVL 34

Expert Comment

by:James0628
ID: 24083092
It seems like the basic problem is that when you use "suppress blank section", when the section is blank and gets suppressed, you still get the "new page after".

 Earlier you seemed to be saying that you only get the extra blank page when the subreport for the last day on the report is blank.  Is that correct?  If the subreport for the last day is not blank, you also get a new page after that.  Why is that not an "extra" blank page?  Just trying to understand the report better.

 James
0
 

Author Comment

by:LucyRRD
ID: 24102009
James,

I only get the extra blank page when both of the main report and the subreport for the last day on the report is blank.  If the subreport for the last day is not blank, I do not get a new page after that.

Thanks,
Lucy
0
 
LVL 34

Expert Comment

by:James0628
ID: 24103630
> If the subreport for the last day is not blank, I do not get a new page after that.

 But if the section that the subreport is in is set to "new page after", you should get a new page after that section whether the subreport is blank or not.    That's not what's happening?

 Hmm.  Or is it that in one case the report goes to a new page, and then there is some more data on the main report, so it's not just a blank page, but in the other case when it goes to the new page, there is nothing more on the main report, so you're left with a blank page?

 James
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now