Results 1 to 2 of 2

Thread: Show all records if parameter field is empty

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    274

    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:
    1. Dim xCR as New Statement
    2. xCR.SetParameterValue("Account", AccountStatement.cboxCompany.Text)
    3. xCR.SetParameterValue("FromDate", AccountStatement.dtpFrom.Value.ToShortDateString)
    4. xCR.SetParameterValue("ToDate", AccountStatement.dtpTo.Value.ToShortDateString)
    5.  
    6. xCR.DataDefinition.RecordSelectionFormula = "{StatementOfAccount.DateOrders} >= {?FromDate}AND {StatementOfAccount.DateOrders}<={?ToDate}"
    7. xCR.DataDefinition.RecordSelectionFormula = "{StatementOfAccount.Company}={?Account}"
    8.  
    9. Me.CrystalReportViewer1.ReportSource = xCR
    10. 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?

  2. #2
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width