Page 291 - Open Soource Technologies 304.indd
P. 291
Unit 13: Working With Reports
folder. We will eventually add this file to our phone database management system. At
this point, my data environment window looks like this (I expanded the PhoneList tab
by clicking the + sign):
Figure 13.3: Data Environment Window.
13.8.1 Creating a Data Report
Once the Data Environment has been created, we can create a Data Report. We will drag things
out of the Data Environment onto a form created for the Data Report, so make sure your Data
Environment window is still available.
1. On the Project menu, click Add Data Report and one will be added to your project. If this
item is not on the menu, click Components. Click the Designers tab, and choose Data
Report and click OK to add the designer to your menu.
2. Set the following properties for the report:
Name—rptPhone
Caption—Phone Directory
DataSource—denPhone (your phone data environment—choose, don’t type)
DataMember—PhoneList (the table name—choose don’t type)
3. Right-click the Data Report and click Retrieve Structure. This establishes a report format
based on the Data Environment.
4. Note there are five sections to the data report: a Report Header, a Page Header, a Detail
section, a Page Footer, and a Report Footer. The headers and footers contain information
you want printed in the report and on each page. To place information in one of these
regions, right-click the selected region, click Add Control, then choose the control you
wish to place. These controls are called data report controls and properties are established
just like you do for usual controls. Try adding some headers.
5. The Detail section is used to layout the information you want printed for each record in
your database. We will place two field listings (Name, Phone) there. Click on the Name
tab in the Data Environment window and drag it to the Detail section of the Data Report.
LOVELY PROFESSIONAL UNIVERSITY 285