Hello there!
I'm new in VFP, exactly 2 and a half weeks using VFP 9.0.
I have a grid, textboxes with labels, an Add command, Remove command and Print command.
When I click on an entry from the grid, then click the Print command, the report preview appears. But the problem is when there's no entry from the grid, and I click the Print command, the report preview still appears. I want to display a messagebox saying no data to print, instead. How can I achieve that?
I used this codes in the Print command:
IF VAL(thisform.grdTAcc.Tag) = 1
cReptitle = "INFORMATION"
SELECT tmp_accinst.* FROM tmp_accinst WHERE 1=2 INTO CURSOR tmp_report READWRITE
SELECT tmp_accinst
SCATTER MEMVAR
INSERT INTO tmp_report FROM MEMVAR
SELECT tmp_report
GO TOP
REPORT FORM rpt_access2 PREVIEW
SELECT tmp_report
USE
ELSE
MESSAGEBOX("No data to print! ",0+16,"User Message")
ENDIF
SELECT tmp_accinst
thisform.refresh
THANKS!!!
I'm new in VFP, exactly 2 and a half weeks using VFP 9.0.
I have a grid, textboxes with labels, an Add command, Remove command and Print command.
When I click on an entry from the grid, then click the Print command, the report preview appears. But the problem is when there's no entry from the grid, and I click the Print command, the report preview still appears. I want to display a messagebox saying no data to print, instead. How can I achieve that?
I used this codes in the Print command:
IF VAL(thisform.grdTAcc.Tag) = 1
cReptitle = "INFORMATION"
SELECT tmp_accinst.* FROM tmp_accinst WHERE 1=2 INTO CURSOR tmp_report READWRITE
SELECT tmp_accinst
SCATTER MEMVAR
INSERT INTO tmp_report FROM MEMVAR
SELECT tmp_report
GO TOP
REPORT FORM rpt_access2 PREVIEW
SELECT tmp_report
USE
ELSE
MESSAGEBOX("No data to print! ",0+16,"User Message")
ENDIF
SELECT tmp_accinst
thisform.refresh
THANKS!!!