次の方法で共有


Integrating Queries and Reports

After you've created the components of your application, you can integrate them. The following illustration shows some ways you can add queries and reports to your application.

Some ways to integrate queries and reports

You can add code that executes a query or a report to the following objects in your application.

To add a query, view, or program

  • Add a DO or USE command to the code behind a command button on a form, a button on a toolbar, or a menu item.

    For example, add code similar to one of the following lines:

    DO MYQUERY.QPR
    DO MYPROGRAM.PRG
    USE myview
    

You have several options for integrating reports into your application.

  • If you want the user to simply start the report and collect the printout, you can have the user initiate a report by adding the REPORT command to a control on a form, a command on a menu, or a button on a toolbar.
  • If you want to allow your user to enter some variables used in the report, you can gather values from the user just as you did for queries. For example, the user could enter a specified date range that the report will include.
  • If you want the user to create custom reports, you can offer the user the ability to create new reports or modify existing reports with the Report Designer.

To run reports and labels

  • Use the REPORT or LABEL commands.

    For example, you could use code similar to one of the following lines:

    REPORT FORM MYREPORT.FRX
    LABEL FORM MYLABEL.LBX
    

To modify reports and labels

  • Use the MODIFY REPORT or MODIFY LABEL commands.

    For example, add code similar to one of the following lines:

    MODIFY REPORT MYREPORT.FRX
    MODIFY LABEL MYLABEL.LBX
    

To create reports and labels

  • Use the CREATE REPORT or CREATE LABEL commands.

    For example, you could use code similar to one of the following lines:

    CREATE REPORT MYREPORT.FRX
    CREATE LABEL MYLABEL.LBX
    

See Also

Saving a Report as HTML | DO | USE | Creating Reports and Labels | SELECT - SQL | Adding a General Field | Selecting, Moving, and Resizing Report Controls | Collecting User Input with Queries