Show all records if parameter field is empty
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:
VB Code:
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?
Re: Show all records if parameter field is empty
Have you tried putting and IF statement in your report selection criteria?
If parameter1 <> "" then
===some selection criteria
else
===some other criteria