Crystal Reports' is a popular third party package that is included with Visual Basic, which allows you to create

reports for your application. The package consists of a designer - where you can design and test the reports, Crystal Reports API calls and Crystal Reports control.

Using Crystal Reports
• COMMON\TOOLS\VB\CRYSREPT • Double-click the file CRYSTL32.EXE • You will be asked if you want to install Crystal Reports. Respond Yes.

To access the Crystal Report Designer, a Start menu group and shortcut will have been automatically created.

A simple report from the sample database BIBLIO.

Click File Menu Click New

•Click on the Custom button to display the Choose Report Type and Data Type frames. •Select the Custom Report and click on the Data File. •Specify the location of the BIBLIO.MDB Access database

•Select which tables from the database you want. For this example we will need the authors table and the Title table. •check that the joins are correct in the Linking Export.

Drag and drop the fields you want on to the report. So that it looks like the report above. Now if you run it by selecting Print Preview, you can see what the report looks like. Now save the report and we have a template that now can be used in VB.

Turn off the Save Data with report option if you want the data to contain new information each time the report is used. Going to the File menu, selecting Options and clicking on the Reporting Tab sets the option

When you have designed your report, the saved file should have an extension .rpt. You can use this report with the Crystal Report control to display or print your report in a VB application. Note:Check the crystal report help files for the files you need to distribute with the control. You will also need any .rpt files that you have created. You will have to add the Crystal Report control to the toolbox, this is done by going to the Project menu and selecting Components , then looking down the list for the control and clicking on it

To use the control add it to a form and set the following properties •ReportFileName - The path and the filename of the .rpt file you have created •DataFiles(0) - The path and the filename of the database that you want it to use. If this is left blank it will use the one in the report. •Selection Formula - The formula to select the subset of data that you want. •Destination - 0 to Preview, 1 to Print To display the report use the .print report method i.e CrystalReport1.Print Report