Print Page | Close Window

Subreport, print "no records" message

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9852
Printed Date: 06 May 2024 at 10:57pm


Topic: Subreport, print "no records" message
Posted By: bealem
Subject: Subreport, print "no records" message
Date Posted: 29 Apr 2010 at 12:29am
Hi,

I've got a main report setup with 3 subreports.

The subreports are each in their own section with "New Page Before" checked so each subreport is on a new page.

What I want is to print out a message when a subreport has no records, rather than just getting the header and the rest of the page blank.

I see lots of posts about surpressing a subreport if no records, but I want it to print with a "no records" message.

How can I do this?

Cheers,
Mike



Replies:
Posted By: lockwelle
Date Posted: 29 Apr 2010 at 3:29am
you could initialize a shared variable to 0, run the subreport (which updates the shared variable the record count) and if the count is still 0, display the message, otherwise, suppress the message and display the report..
 
the tricky part is the initializing of the variable...but you could create a new section and intialize it above the subreport...just will be creating a lot of sections...well you could initialize all the subreport variables at once, and if the subreports run after, say a group header, you could initialize them all there...so maybe not so many sections....
 
HTH


Posted By: bealem
Date Posted: 30 Apr 2010 at 12:43am
Hi lockwelle,

Your post got me heading in the right direction.

After doing more searches about what you said, and looking at unboundfields (I guess that's what you meant) nothing was working right.

I then came across a post on another site that said to try and use a running total field that counted.

Inserted one of these for one of my fields, and then used the result to suppress (or not) the report footer that has the "no records" message.

Ta,
Mike



Print Page | Close Window