Step 3: Preview the Data Report Using the Show Method

Now that the data environment and the data report objects have been created, you are almost ready to run the project. One step remains: to write code to show the data report.

To show the data report at run time

  1. On the Project Explorer window, double-click the frmCustomers icon to display the Form designer.
  2. On Toolbox, click the General tab.
  3. When you add a Data Report designer to your project, its controls are added to the tab named DataReport. To use the standard Visual Basic controls, you must switch to the General tab.

  4. Click the CommandButton icon and draw a CommandButton on the Customer form between the Update and the Close command buttons.
  5. Set the properties of the Command1 control according to the table below:
  6. Property

    Setting

    Name

    cmdReport

    Caption

    Report

  7. In the button's Click event, paste the code below.
  8. Private Sub cmdReport_Click()
    rptSoundAdviceCustomers.Show
    End Sub
  9. Save and run the project.
  10. Click Report to display the report in print preview mode.
  11. Use the techniques listed above to set up the Data Report Designers for the Employees and Compact Discs tables in the Sound Advice database and place the Report command buttons on their corresponding forms. When complete your project will contain one Data Environment (Sound Advice) and three different Data Reports representing the Customers, Employees and Compact Discs tables in the Sound Advice database.

 | Assignments | Hints and Corrections | Outputs | Requirements |