Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display Text Box if report has no data

Status
Not open for further replies.

glalsop

Technical User
Aug 9, 2003
435
US
Good afternoon all -

Background:
I am using Crystal Reports 8.5 connecting to a SQL Server backend. I currently have several reports that were designed in Crystal and several that were designed in Access (all connect to the same database). This tends to confuse some of the users, they have a difficult time remembering where certain reports are. So...

I have created an Access app that uses VBA and RDC so that all the reports can be viewed from the same place. This works fine.

Problem:
Some of the reports need to be run on a periodic schedule, i.e., monthly, weekly, etc. I am writing procedures to automate this task, but some months certain reports will have no data and other months they will have data. Since I am automatically .pdf'ing these files to Web Server folders, I would like the report file to essentially say something like "No Data" if there is no data. I have tried several methodologies and only get a blank report.

If this is not possible with Crystal I would be perfectly happy to incorporate the no data check into my VBA code. Is there a method for this that I can call through RDC?

Thanks in advance for any ideas.



-Gary
 
Create a text object with the text "No Data" wherever you'd like it to show, and enter a suppression formula like:

isnull({Table.Field})

If the report didn't return any data, then presumably, all of the report fields would be NULLs.

Be sure to look under File>Report Options to make sure you don't have a check in "Suppres Printing if No Records".

-dave
 
Thanks for the reply Dave -

This is the first method that I tried. I put my text box in a second Report Footer and entered a suppression formula to suppress the section if one of my table fields was not null. Presumably if the field WAS null, my text box should print, but it doesn't. It seems as if Crystal never processes the suppression formulas, etc. if no data is returned, but I dunno.

Any more suggestions?

-Gary
 
No idea... it's always worked for me. Recheck the logic in your suppression formulas, and make sure you're checking on a field that will always have a value.

-dave
 
Try the solution I suggested in this thread...

thread767-753547
 
Or try my solution from the same thread:

You can create a text box with the message "No Data is Returned" and then go to format text->suppress->x+2 and enter:

Not isnull({table.ID})

//where {table.ID} is a field that appears in every record.

I tested this for field suppression and section suppression, and it worked every time, as a formula or as text in a text box, in the report header or the report footer.

-LB
 
<blushing>

Thank you all for your replies, and yes they all work...

Unless you have 'Suppress Printing If No Records' checked in the Report Options.

-Gary
 
Sorry to waste your time with such a mundane issue, but again thanks for your replies...

-Gary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top