Creating a button to preview a report

Report criteria forms are typically used to preview and print reports from a report object source. To preview the report, you must have a Preview button on the report criteria form.

To create a Preview button for a report:

  1. With the report criteria form open and in Design Mode, add a Button component with these specifications:
    • Name: PreviewButton
    • Caption: sPreview
  2. Create a form event and event handler to generate the report preview:
    1. With the new Preview button selected, select the Events property sheet.
    2. In the Primary field, specify PreviewReport as the form event name.
    3. Click the ellipsis () button for the Primary field.
    4. In the Event Handlers dialog box, click New.
    5. In the Event Handler Properties dialog box, specify a Response > Type of:
      • Print Preview for a Report-template type form or an SSRS report definition file
      • Run Form for a DataView report
    6. In the Response > Parameters field, click the ellipsis button.
    7. In the Event Handler Parms dialog box, for the Error Message, specify mPrintPreviewError.
    8. Click Type Specific Parameters.
    9. If you are creating the report criteria form for:
      • A Report-template type form or an SSRS report, continue with substep j.
      • a DataView report, skip substep j. and continue with substep k.
    10. In the Edit Background Task Name and Parms dialog box, specify these values:
      • Task Name: V(BGTaskName)
      • Task Parms: V(BGTaskParms)

      Continue with substep l.

    11. In the Specify Form Run Options dialog box:
      • Form: Select SBDataViewResults
      • Click Set Variables and use the Edit Set Variable Values dialog box to set these variable values:
        • DataViewName=nameOfDataView

          where nameOfDataView is the name of the predefined DataView for which the report criteria form is being created.

        • DataViewPromptForInputs=0

          (This is optional, but if you do not set this variable value, and you submit the DataView report preview without any option specifications, you are prompted for the inputs when you click Preview.)

        • InputParameter1=V(firstInputParameter)

          where firstInputParameter is the name of the variable that corresponds with the first input parameter as set on the DataViews Setup form.

        • InputParametern=V(nthInputParameter)

          where n is the number of each succeeding input parameter and nthInputParameter is the name of the variable that corresponds with each succeeding input parameter as set on the DataViews Setup form.

    12. In each dialog box, click OK until you have returned to the form.