PDA

Click to See Complete Forum and Search --> : Show all records if parameter field is empty


aldrean
Sep 13th, 2006, 01:25 AM
Hi everyone, I am using vb.net as a front end and Access2000 as by database.I had three parameters in my crystal report(Account,FromDate,ToDate) and I was implementing these codes in filling up the parameters:

Dim xCR as New Statement
xCR.SetParameterValue("Account", AccountStatement.cboxCompany.Text)
xCR.SetParameterValue("FromDate", AccountStatement.dtpFrom.Value.ToShortDateString)
xCR.SetParameterValue("ToDate", AccountStatement.dtpTo.Value.ToShortDateString)

xCR.DataDefinition.RecordSelectionFormula = "{StatementOfAccount.DateOrders} >= {?FromDate}AND {StatementOfAccount.DateOrders}<={?ToDate}"
xCR.DataDefinition.RecordSelectionFormula = "{StatementOfAccount.Company}={?Account}"

Me.CrystalReportViewer1.ReportSource = xCR
Me.CrystalReportViewer1.Show()

The whole thing is doing fine that is if all the three controls in my form are filled with the parameters.But if for instance cboxCompany was empty, the whole report was not displaying any data.Suppose to be if that control is empty, all of the records pertaining to the dates will be displayed regardless of their company.Can someone help me please?

Pasvorto
Sep 13th, 2006, 10:13 AM
Have you tried putting and IF statement in your report selection criteria?

If parameter1 <> "" then
===some selection criteria
else
===some other criteria