Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Peter Norton's Guide to Visual Basic 6
(Publisher: Macmillan Computer Publishing)
Author(s): Peter Norton
ISBN: 0672310546
Publication Date: 09/09/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Starting the Design Process

To start the process, choose File, New from the menu to open the New Report dialog box. For the sample report you will be using the standard report format; however, Crystal Reports can assist you in creating many different styles of reports from this dialog box:

•  Standard—Creates a standard report with rows and columns. It often has summary information at the bottom of the columns.
•  Listing—Creates a simple row and column listing of the information in a recordset.
•  Cross-Tab—Inverts the order of a standard columnar report. It is often used to obtain a quick summary view of a more complex set of data.
•  Mail Label—Creates items such as mailing labels or name tags from the information in your database.
•  Summary—Presents summary information about the data, such as total and average sales or the number of attendees.
•  Graph—Shows the information in a graphical form.
•  Top N—Shows only a specified number of the top records in the recordset. For example, this report style can be used to show the top five salespeople in the company.
•  Drill Down—Shows the supporting information, or detail information, for each record.

After selecting the Standard report option and clicking OK, the related Report Wizard is automatically started. For the style selected, seven steps are involved in creating the initial report (see Figure 14.8).


Figure 14.8.  The Report Wizard steps you through the creation process.

Choosing a Database

The logical starting point of any report is to select the database tables required for the report. The first tab of the wizard displays the data access choices and any tables already included in the report. To select the data source for the report you are building, select the Data File button to display the Choose Database File dialog box (see Figure 14.9).


Figure 14.9.  Choose the database for the report.


Note:  For the purposes of this discussion, you will be using the Northwind database (…\Microsoft Visual Studio\VB98\NWIND.MDB), which is included with Visual Basic.

Setting the Relationships

After you select the database, all the tables and queries available in the database are added to the report. If you see the wizard in the background, you will see the tables and queries listed. Click the Done button to return to the wizard. You are then automatically taken to the wizard’s second tab.


Warning:  If you are using an ODBC/SQL database, you will be shown a list of tables and queries from which to select. Only the tables and queries that you select will be included in the report.

The Links tab of the Report wizard enables you to modify the join information that is already defined in the database. Because the Northwind database already has the join information defined, the joins are displayed (see Figure 14.10). On this tab, a message is displayed, enabling you to add more tables if needed.


Figure 14.10.  Define or modify the joins for a report.

Selecting the Fields for the Report

If the joins are correct, click the Next button to continue to the Fields tab. The Fields tab (see Figure 14.11) enables you to select the fields from each of the tables you need in the report.

You add the fields to the report data list by double-clicking each field in the Database Fields list or by highlighting the fields you want and clicking the Add button. In addition, you can position the fields in the report. For each field selected, you can also enter a custom column heading in the text box below the list. Select the fields listed in Table 14.3 and add them to the fields list for the report.


Figure 14.11.  Select the data fields from the included tables and queries.

Table 14.3. Database fields for the sample report.

Table Field

Customers CustomerID
CompanyName
ContactName
Address
City
Region
PostalCode
Orders OrderID
OrderDate
Order Details ProductID
Quantity
UnitPrice
Discount
Products ProductName


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.