Crystalreports

Páginas: 16 (3781 palabras) Publicado: 16 de septiembre de 2011
Using Crystal Reports
Level:

Written By TheVBProgramer.
This tutorial shows you how to use Crystal Reports 4.6, which is the version of Crystal Reports that shipped with Visual Studio / Visual Basic 6.0. Crystal Reportsprovides a relatively easy way to incorporate reporting into your application. The basis of a report is a database query.
It should be pointed out that this version ofCrystal Reports is quite old, and that this version and the past versions of Crystal Reports that have shipped with VB are generally "watered down" versions that do not have all the bells and whistles of the standalone product that is sold by Seagate Software. Furthermore, CR 4.6 will not work with MS-Access databases higher than Access 97. That said, what you learn about designing reports with CR 4.6will help when working with later versions. Regarding the MS-Access issue, later versions of Access (2000, 2002, etc.) can read and save in Access 97 format.
 
Installing Crystal Reports 4.6
Crystal Reports 4.6 is bundled with Visual Studio/Visual Basic 6.0, but it is not installed automatically. To install it manually, locate the CRYSREPT folder on your installation CD – for Visual Studio6.0, the path is COMMON\TOOLS\VB\CRYSREPT on the third CD. In that folder, double-click the file CRYSTL32.EXE. You will be asked if you want to install Crystal Reports. Respond Yes. It will then tell you where it is going to install CR; you can override the location if desired. Following that, CR will be installed, and a few moments later you should get a message indicating that installation wassuccessful.
 
The Sample Database
The sample database used for this tutorial (as well as others to follow) is an Access 97 format database named EMPLOYEE.MDB.
 
EMPLOYEE.MDB contains three tables: EmpMast, DeptMast, and JobMast. The tables are structured as follows:
 
EmpMast table:
 
Field Name | DataType | Comments |
EmpNbr | AutoNumber | Primary Key. Uniquely identifies each employee inthe database. |
EmpFirst | Text (50) | Employee's first name |
EmpLast | Text (50) | Employee's last name |
DeptNbr | Number (Long Integer) | Foreign Key to PK of DeptMast table. Identifies which department the employee works in. |
JobNbr | Number (Long Integer) | Foreign Key to PK of JobMast table. Identifies the employee's job. |
HireDate | Date/Time | Date the employee was hired |HrlyRate | Number (Single) | Employee's hourly rate |
SchedHrs | Number (Single) | The number of hours per week the employee is scheduled to work. |
 
DeptMast table:
 
Field Name | DataType | Comments |
DeptNbr | Number (Long Integer) | Primary Key; uniquely identifies each department in the database. |
DeptName | Text (50) | The name of the department. |
Location | Text (50) | Thedepartment's location (could be a building, suite number, floor, etc.) |
 
JobMast table:
 
Field Name | DataType | Comments |
JobNbr | AutoNumber | Primary Key; uniquely identifies each job in the database. |
JobTitle | Text (50) | The job title (description). |
MinRate | Number (Single) | The minimum hourly rate that somebody working in this position is usually paid. |
AvgRate |Number (Single) | The average hourly rate that somebody working in this position is usually paid. |
MaxRate | Number (Single) | The maximum hourly rate that somebody working in this position is usually paid. |
 
Designing the Reports
 
Two reports will be developed from this database: "Annual Salary Expenses by Department" and "Annual Salary Expenses by Job".
 
For the Annual Salary Expensesby Department report, you want to show various fields from the employee database tables grouped and subtotaled by department. You also want to show a grand total at the end of the report. A sketch of the design might look something like the following:
 
 
Annual Salary Expenses by Department
 
JOB WKLY HRLY
EMP # EMP NAME # JOB TITLE HIRE DATE HOURS RATE ANN SALARY
----- -------- ---...
Leer documento completo

Regístrate para leer el documento completo.

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS