Need to cancel report from OnNoData
Is that possible?
In the OnNoData event I would like to cancel the report.
I tried using Report.Cancel, but the report still shows up even though it is
empty.
Is there a way to do that? Essentially I would like to bring up a message
"No data for this report... etc" and then cancel the report, i.e. not show
it at all.
Thank you.
In the OnNoData event I would like to cancel the report.
I tried using Report.Cancel, but the report still shows up even though it is
empty.
Is there a way to do that? Essentially I would like to bring up a message
"No data for this report... etc" and then cancel the report, i.e. not show
it at all.
Thank you.
This discussion has been closed.
Comments
True) then in the OnCreatePreviewer post a WM_CLOSE message to the
previewer.
--
Ed Dressel
Team DM
However FCanceReport property or OnCreatePreviewer event do not exist in my
version - 6.02 Enterprise.
Is there some other way to cancel report if there is no data? Basically I
would like to show a custom message to the user and that is all.
When I bring up the custom message via the OnNoData event, the report still
comes up after that and is empty.
If you do not want the report to show up at all, I would suggest simply
checking your dataset before calling Report.Print for no records. Something
like the following...
- Using TQuery...
if (Query.RecordCount = 0) then
ShowMessage('No Data for this Report')
else
ppReport1.Print;
- Using DBPipeline
if (ppDBPipeline.BOF) and (ppDBPipeline.EOF) then
ShowMessage('No Data for this Report')
else
ppReport1.Print;
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com