PREVIEW Function (Report)

Indicates whether a report is being printed in preview mode.


IsPreview := PREVIEW

Type: Boolean

true if the report is run in preview mode; otherwise, false.

You must use the return value. A compile error is generated if this value is not used.

Differences Between the Classic Client and RoleTailored Client

In the Classic client, if you run a report in preview mode and then call CurrReport.PREVIEW, then printing is disabled. If you click the Print icon at the bottom of the Print Preview window, then you get the following error message.

This report cannot be printed from Print Preview. Quit Print Preview and run the report.

The following illustration shows the Print icon in the Classic client Print Preview window.

Print icon in Classic request form

In the RoleTailored client, if you run a client report definition (RDLC) report layout in preview mode and then call CurrReport.PREVIEW, then the Print icon, Print Layout icon, Page Setup icon, and Save As icon are not displayed.

If you run a client report definition (RDLC) report layout in preview mode and do not call CurrReport.PREVIEW, then you can print from the Print Preview window.

The following illustration shows the Print icon in the RoleTailored client Print Preview window.

RDLC report print icon

This example shows how to use the PREVIEW function. You can use this function in an application that stores a count of how many times a document has been printed in the database. This number must be updated from inside the report that is used to print the document. To avoid updating the number when the report is run in preview mode, add a construct to the OnPreDataItem trigger that is like the one that is shown in this example when adding the code that updates the count.

IF CurrReport.PREVIEW THEN
... // Preview-specific processing
ELSE
... // Processing that is not preview specific:
... //  Update the print count

Community Additions

ADD
Show: