Introduction

Sometimes we want to do tricks with the Crystal Reports engine, like profiting from the Exporting functions to create Word, Excel, or PDF files. What if we don't read the data from a database? This article shows the details on creating a Crystal Reports sub report, and how to fill it from code, without a database.

Using the code

Create the Project:

File -> New -> New project

Create a New Crystal Reports Visual Basic Windows Application.

Create the DataSet schema:

Right click the Crystal Reports project -> Add -> New Folder

Name it DataSets.

Right click the DataSets folder -> Add -> New Item

Create a new CRDataSet DataSet.

Right click the CRDataSet Designer Page -> Add -> New Element

Name it MainTable.

Add new Field1, Field2, Field3 rows.

Repeat steps 3 and 4, add a new DetailTable element.

You will have the following DataSet tables schema:

Create the Crystal Reports report:

Right click the Crystal Reports project -> Add -> New Folder

Name it Reports.

Right click the Reports folder -> Add -> New Item

Open a new MainReport Crystal Reports report.

Click the Register Later button to close the annoying register window, if it appears.

History

21 Nov 2006 - Posted.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.