Page 29 - Open Soource Technologies 304.indd
P. 29

Unit 2: Working of VB Applications



                  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. 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, and 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.
                    Two items should appear: a text box Name and a text box Name (PhoneList). The first text
                    box is heading information. Move this text box into the Page Header section. The second
                    text box is the actual value for Name from the PhoneList table. Line this text box up under
                    the Name header. Now, drag the Phone tab from the Data Environment to the Data Report.
                    Adjust the text boxes in the same manner. Our data report will have page headers Name
                    and Phone. Under these headers, these fields for each record in our database will be
                    displayed. When done, the form should look something like this:



























                                          Figure 2.15: Data Report Creating.



                                      LOVELY PROFESSIONAL UNIVERSITY                         23
   24   25   26   27   28   29   30   31   32   33   34