cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with the Selection Formula and a Parameter Field.

Former Member
0 Kudos

Hello everyone,

In my report the report displays fine (except too man records are shown) if I don't put in my Selection Formula. However, if I use a selection formula that references a Parameter Field, when the form first displays it will prompt me for the Value of the Parameter Field. I have set all this in C# in Visual Studio and as I said it does not prompt me if I don't have a Selection Formula. Can we use a Parameter Field in a Selection Formula?

public partial class ReportForm : Form

{    

          private readonly string _batchNumber;   

          public ReportForm(string batchNumber)   

          {       

                    _batchNumber = batchNumber;        

                    InitializeComponent();   

           }   

          protected override void OnLoad(EventArgs e)   

          {       

                    APGreenSheets report = new APGreenSheets();       

                    DataSet data = AccountsPayableController.FillDataSet();       

                    report.SetDataSource(data);       

                    report.SetParameterValue("BatchRef", _batchNumber);       

                    crystalReportViewer1.ReportSource = report;       

                    crystalReportViewer1.RefreshReport();       

                    base.OnLoad(e);  

          }

}

My Selection Formula in question (I used the Wizard to write this): {AP_HistoryHeader.strBatchRef} = {?BatchRef}

Visual Studio 2015/2013 (Same Behavior)

CrystalReports for Visual Studio 13.0.14 or 13.0.15

I will attach any files you wish me to.

Thanks in advance,

Randy

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Randy,

Click on your form and the CR Viewer and look at the properties and change the ReuseParameterValue.... Prompt setting, set it to False:

Don

Former Member
0 Kudos

Thanks Don,

It was already set to False. I also tried to set it to true. Same results either way.

0 Kudos

OK, then remove the RefreshReport line.

Set the parameter value to "" nothing or use .Reset(). it's using the same value you first set.

Don

Former Member
0 Kudos

Removing the RefreshReport line worked. Thanks again.

Answers (0)