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

How can i force the report to outpout "Nothing to print" when the cursor / table has no records?

Reports

How can i force the report to outpout "Nothing to print" when the cursor / table has no records?

by  vgulielmus  Posted    (Edited  )

1 Add a report variable cAlias with
Value to store: = cAlias
Initial value: = cAlias
Reset value based on: = Report
Calculation type: = None

2 In the Init event of the Data Environment add
[code Foxpro]cAlias=ALIAS()
LOCAL cNewAlias
cNewAlias=SYS(2015)
IF RECCOUNT(cAlias)=0
SELECT * FROM (cAlias) WHERE .F. INTO CURSOR (cNewAlias) READWRITE
APPEND BLANK
SELECT (cNewAlias)
ENDIF[/code]

3 Select all the objects you want to hide when the cursor has no records, choose Properties and add to Print when expression alias()==cAlias

4 Add a new label with text "Nothing to print" and with the Print when expression alias()!=cAlias

Vilhelm-Ion Praisach
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top