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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How could I know if there is no data in a report? Using CR 8.5 1

Status
Not open for further replies.

lorein

Programmer
Oct 21, 2003
25
MX
Hi

I have a VB 6 application using crystal reports 8.5 and the crystal OCX. My data base is oracle and i'm using stored procedures.
I want to know if a report has data or not in order to have some text in the report instead a blank page.

Does anybody know how do this??
I really appreciate your help!

Thanks
Lorein

Lorein....
 
Place a text object saying "No Records Found" on the report layout and control its (or its section) suppress attribute with an expression of:

Count({some_field}) > 0

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Thanks for your response.
But I don't know how to enable a section in a report when is no data?

I tried using the count and recordcount functions and when the report has no data I receive a blank page.

I don't know in wich part of the report I have to evaluate the number of records

Some body knows how do this???

Lorein....
 
To follow Ido's suggestion, place a text box in the report header with the text "No Records". Then go to the section expert (format->section)->report header->suppress->x+2 and enter:

count({table.ID}) > 0 //use a table field that occurs in each record

This will suppress the text "No records" when there are records, but in the case of no data, the text will appear.

-LB
 
An alternative is to have a report-header section saying 'No Data' with a suppression formula that checks some basic field:
Code:
not isnull ({AccNo})

This should only appear when there is no data, or no data that qualifies.

Madawc Williams
East Anglia, Great Britain
 
Thank you very much for your help IdoMillet, Ibass, Madawc

Lorein....
 
Hi

I have a problem again about this issue.
I add in the report header section in the section expert (format->section)->report header->suppress->x+2
the next condition:
count(Accounnumber)>0

and it works when the report has information because doesn't show the label "No data in the report" that I add in the report header, but when is no data the label doesn't appear in the report.

Some body knows why this is happend????

I really appreciate your help!



Lorein....
 
Hi IdoMillet

I already try with:

not isnull({AccountNumber})

({AccountNumber})=""

recordnumber({AccountNumber})>0

But I think when the stored procedure doesn't has any data crystal didn't know or something like that.

In all testing that I did all these options worked when there was data because didn't show the label in the reprot header , but didn't work when there was no data.

Do you know if there is another cause for this problem?

thank you !!

lorein

Lorein....
 
Did you check in file menu >>> report options
You have to uncheck the option 'don't print if empty'

--------------------------------------------------
[highlight]Django[/highlight] [thumbsup]
bug exterminator
tips'n tricks addict
 
thanks Django, now its working!

Lorein....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top