Creating a Formatted Bound Report at Runtime

The following steps describe an alternative method of creating formatted bound reports:

  1. Create your Visual Basic application as in the first example above.
  2. Set the ActiveX Control to print to a preview window, and run the application.
  3. Click the Export button in the preview window, and export the report to a disk file in .RPT format.
  4. Once the report has been exported, you can open it up in Crystal Reports.
  5. Perform all formatting changes that you want and save the report.
  6. Return to the Visual Basic application and stop it if it is still running.
  7. On the ActiveX Control:
  8. Set the ReportSource to 0 - Report File.
  9. Set the ReportFileName to the .RPT file that you created.
  10. Run the Visual Basic application and you will be able to see your bound report with the formatting changes you've made.

Note:    

When passing properties at runtime using bound reports (i.e., SortFields), the syntax is slightly different. For example, the following syntax would be used for the Formulas and SortFields properties in a normal report:

CrystalReport1.Formulas(0) = "COMMISSION= {TableName.FIELDNAME}"
CrystalReport1.SortFields(0) = "+{TableName.FIELDNAME}"

However, for a bound report, the following syntax would be used:

CrystalReport1.Formulas(0) = "COMMISSION= {Bound Control.FIELDNAME}"
CrystalReport1.SortFields(0) = "+{Bound Control.FIELDNAME}"


Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com