Partilhar via


How to: Load Data Environments for Reports

You can load a data environment for your report or label from another report (.frx) or label (.lbx) file, or from a visual DataEnvironment class definition.

You load the data environment from the Data Environment tab of the Report Properties dialog box.

Important

The ability to load a Data Environment is a feature provided by the ReportBuilder application. If the _REPORTBUILDER system variable is not set to the default Report Builder or is set to a third-party builder, the Report Properties dialog box displays or a different dialog box might display. For more information, see _REPORTBUILDER System Variable and Report Page Setup Dialog Box.

To load a data environment from another report

  1. Open the report or label to which you wish to add the data environment in the Report or Label Designer.

  2. On the Report menu, click Load Data Environment. Alternatively, choose Properties from the menu and click the Data Environment tab of the Report Properties dialog box.

  3. Select the option button to Copy from another report file.

  4. Click the Select button. The Open Dialog Box (Visual FoxPro) appears. Choose the report (.frx) or label (.lbx) file from which you wish to copy the Data Environment, and click OK.

  5. A message appears in a dialog box informing you that you are about to overwrite the current contents of your Data Environment for this report. If you are ready to do so, confirm by clicking Yes; otherwise, click No to cancel.

  6. The ReportBuilder confirms that it has updated the report or label's Data Environment, with a second dialog box.

  7. Open the report's Data Environment and verify that the tables and views from the original report or label's Data Environment are now loaded into this one. Any code from the original Data Environment should be repeated in the appropriate Data Environment methods.

To load a data environment from a DataEnvironment-based class definition

  1. Open the report or label and navigate to the Load Data Environment tab of the Report Properties dialog box, as above.

  2. Select the option button to Link to a DataEnvironment class.

  3. Click the Select button and choose an appropriate class library (vcx) or program file (prg) and DataEnvironment-based class from the list.

  4. As above, confirm that you wish to overwrite your existing Data Environment information. The ReportBuilder will provide an error message if the class you chose does not descend from DataEnvironment, or it will confirm that it has successfully updated the Data Environment in the current report or label.

  5. Open the report's Data Environment and verify that the tables and views from the visual class are now loaded into this report or label's Data Environment. You will find code, written by the ReportBuilder, binding the events and methods of the visual class included in the report or label's Data Environment code snippets. You can edit this code if needed.

See Also

Tasks

How to: Save Report Data Environments as Classes