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

VFP 6.0 Report with Cursor - No Records Found???

Status
Not open for further replies.

DaveL

Programmer
Jun 8, 2000
40
US
I am creating very simple reports that are populated by cursors. My problem is that when there are no records in the cursor, the report does not execute. I need the report to print with a message such as "No Records Found".

I know it is a simple concept, but I can't seem to find an answer???

Thanks !
 
I think, your report is not having any header band or summary band. So if the body is not available, the report is not cast. If you have a summary band with information..
IIF(recoount()=0,"Nothing to report","End of report")
The report will be cast as per your request.

ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Hi Dave,

It's not all that simple. As far as I know, FoxPro just won't run a report from an empty file.

I would suggest: Check the cursor - if it's empty insert some sort of dummy record that the report can recognize. Then have the report do what you want when it sees this record.

Jim
 
Just an after thought!..
I always display a message box stating that "There is nothing to report!" with a OK button whenevr the file is empty. I think this is better than just dumping a page telling nothing to report. But the 'Users demand is always right!' and you are holding the fort!
If this is a must, you can append a blank record and replace one of the text content which will be reported in the mid of the page.. "Report Empty!!". So when the report is printed, you will get the meassage.
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Hi!

ramani, the other solution is not just put the message 'Report is empty' that is meaningless for users and cause a lot of work. Report usually have a report title and report footer, right? What if you print all this without details? This will show that, for example, there were no transactions last week... If you have summary, it will show zeros etc. I gues this have better meaning for users from report point of view, as well as it is easy to implement because you do not need to hide all elements when report is empty, but just a set an optin to skip entire row if fields are empty in the detail band.


Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
DaveL,

I'm unsure whether you want to print "No records found" on screen or on the paper print out?

if an on screen message is required, you could try after selecting to cursor..

if _tally = 0
MESSAGEBOX('No records found', 0+48+0, 'Title')
else
endif


To phyiscally print a report I would first create a report with just a label with 'No Records found' named 'norec'
Then use the code with an extra line..

if _tally = 0
REPORT FORM norec TO PRINTER (or PREVIEW to view)
else
endif

Hope this helps
Ted
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top