2054263 - How to force parameter prompts without using the Crystal Reports web viewer

SAP Knowledge Base Article - Public

2054263 - How to force parameter prompts without using the Crystal Reports web viewer

Symptom

  • The parameter prompt screen is invoked by the Crystal Reports viewer.
  • When printing a report directly without displaying the viewer, the parameter prompt is not invoked.

Environment

  • SAP Crystal Reports, Developer Version for Visual Studio .NET
  • Microsoft Visual Studio .NET 2010 / 2012 / 2013.

Reproducing the Issue

  • Using the following code will not invoke the parameter prompt:

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
        Dim ReportDocument1 As New CrystalDecisions.CrystalReports.Engine.ReportDocument
        ReportDocument1.Load("C:\WindowsApplication7\test.rpt")
        ReportDocument.PrintToPrinter(1, True, 1, 1)
End Sub

Cause

  • As the Crystal Reports viewer is not used, the parameter prompt is not invoked.

Resolution

  1. Add a viewer to the project.
  2. Set the "Doc" property to none.
  3. Set the viewer property DisplayStatusBar to False.
  4. Shrink the viewer so it only displays the print button on the viewer manu bar.
  5. In the simples project, the code to sue would be:

 

Dim crReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument

crReportDocument.Load(<path to the report with parameter prompt>)
CrystalReportViewer1.ReportSource = crReportDocument
CrystalreportViewer1.ReportSource = crReportDocument

6. Run the project. The project should prompt for database login - if needed and for the parameters the report needs.

A screenshot of the project:

Untitled.png

Note that in the above project the viewer was shrunk so that the export, refresh and print buttons would be visible. The viewer can be further shrunk to only show the print button.

Keywords

cr crvs param 2010 2012 2013 asp .net app applicatioin , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio