Creating a button to print a report

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

To create a Print button for a report:

  1. With the report criteria form open and in Design Mode, add a Button component with these specifications:
    • Name: PrintButton
    • Caption: sPrint
  2. Create a form event and event handlers to generate the report:
    1. With the new Print button selected, select the Events property sheet.
    2. In the Primary field, specify GenerateReport 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 Run Background Task.
    6. In the Response > Parameters field, click the ellipsis button.
    7. Click Type Specific Parameters.
    8. In the Edit Background Task Name and Parms dialog box, specify these values:
      • Task Name: V(BGTaskName)
      • Task Parms: V(BGTaskParms)
    9. If you are planning to schedule the report for automatic generation later, specify these additional values:
      • Task Status: V(BGTaskStatus)
      • Task Number: BGTaskNumber
    10. In each dialog box, click OK until you have returned to the Event Handlers dialog box.
  3. Repeat substeps 2d. through 2i. to create a second event handler with these specifications:
    • Response > Type: Run Script
    • Response > Parameters: ReportSubmitted()
    Note: This event simply runs a built-in script that lets you know when the report has been successfully generated. To have the system notify you when the report is not successfully generated, specify an error message in the Error Message field of the Event Handler Parms dialog box.
  4. In the Event Handlers dialog box, click OK.
  5. Save and close the report criteria form.
  6. Reopen the form and test it to make sure the report prints.
    Note: At this point, the entire contents of the report source should print, because typically you have not yet set up the associations between this form and the report object.