views:

66

answers:

1

Last time I used two parameter to query & show report. It worked well. Right now I am trying to use same code with another extra parameter but its not working. I am confused. Let me show you my code.

Code which worked well:

Parameter fields : bdate and edate

Crystal report formula : {Bal_sheet.bsdate} >= {?bdate} and {Bal_sheet.bsdate} <= {?edate}

Code to show report :

Private Sub butsbalsrep_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butsbalsrep.Click
    Dim cryRpt As New ReportDocument
    cryRpt.Load(Application.StartupPath & "\CrystalReport3.rpt")

    Dim crParameterFieldDefinitions As ParameterFieldDefinitions
    Dim crParameterFieldDefinition As ParameterFieldDefinition

    Dim crParameterFieldDefinitions1 As ParameterFieldDefinitions
    Dim crParameterFieldDefinition1 As ParameterFieldDefinition


    Dim crParameterValues As New ParameterValues
    Dim crParameterValues1 As New ParameterValues

    Dim crParameterDiscreteValue As New ParameterDiscreteValue
    Dim crParameterDiscreteValue1 As New ParameterDiscreteValue

    crParameterDiscreteValue.Value = cmbbdate.Text
    crParameterDiscreteValue1.Value = cmbedate.Text

    crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
    crParameterFieldDefinition = crParameterFieldDefinitions.Item("bdate")

    crParameterFieldDefinitions1 = cryRpt.DataDefinition.ParameterFields
    crParameterFieldDefinition1 = crParameterFieldDefinitions.Item("edate")

    crParameterValues = crParameterFieldDefinition.CurrentValues
    crParameterValues1 = crParameterFieldDefinition1.CurrentValues

    crParameterValues.Clear()
    crParameterValues1.Clear()

    crParameterValues.Add(crParameterDiscreteValue)
    crParameterValues1.Add(crParameterDiscreteValue1)

    crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
    crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1)


    crysrepbalsht.ReportSource = cryRpt
    crysrepbalsht.Refresh()
End Sub

Code which is not working:

Parameter fields : idnmb and acyer and etyp

Crystal report formula : {res_info.stu_id} = {?idnmb} and {res_info.yr} = {?acyer} and {res_info.etype} = {?etyp}

Code to show report :

Private Sub butsrrepsr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butsrrepsr.Click
    Dim cryRpt As New ReportDocument
    cryRpt.Load(Application.StartupPath & "\CrystalReport3.rpt")

    Dim crParameterFieldDefinitions As ParameterFieldDefinitions
    Dim crParameterFieldDefinition As ParameterFieldDefinition

    Dim crParameterFieldDefinitions1 As ParameterFieldDefinitions
    Dim crParameterFieldDefinition1 As ParameterFieldDefinition

    Dim crParameterFieldDefinitions2 As ParameterFieldDefinitions
    Dim crParameterFieldDefinition2 As ParameterFieldDefinition

    Dim crParameterValues As New ParameterValues
    Dim crParameterValues1 As New ParameterValues
    Dim crParameterValues2 As New ParameterValues

    Dim crParameterDiscreteValue As New ParameterDiscreteValue
    Dim crParameterDiscreteValue1 As New ParameterDiscreteValue
    Dim crParameterDiscreteValue2 As New ParameterDiscreteValue

    crParameterDiscreteValue.Value = cmbsrrepidn.Text
    crParameterDiscreteValue1.Value = cmbsrrepay.Text
    crParameterDiscreteValue2.Value = cmbsrrepet.Text

    crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
    crParameterFieldDefinition = crParameterFieldDefinitions.Item("idnmb")

    crParameterFieldDefinitions1 = cryRpt.DataDefinition.ParameterFields
    crParameterFieldDefinition1 = crParameterFieldDefinitions.Item("acyer")

    crParameterFieldDefinitions2 = cryRpt.DataDefinition.ParameterFields
    crParameterFieldDefinition2 = crParameterFieldDefinitions.Item("etyp")

    crParameterValues = crParameterFieldDefinition.CurrentValues
    crParameterValues1 = crParameterFieldDefinition1.CurrentValues
    crParameterValues2 = crParameterFieldDefinition2.CurrentValues

    crParameterValues.Clear()
    crParameterValues1.Clear()
    crParameterValues2.Clear()

    crParameterValues.Add(crParameterDiscreteValue)
    crParameterValues1.Add(crParameterDiscreteValue1)
    crParameterValues2.Add(crParameterDiscreteValue2)

    crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
    crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1)
    crParameterFieldDefinition2.ApplyCurrentValues(crParameterValues2)

    CrystalReportViewer3.ReportSource = cryRpt
    CrystalReportViewer3.Refresh()

End Sub

I am confused why its not working! When I click on show report button it shows nothing(I dont get error message and getting no records back.). I have written {res_info.stu_id} = {?idnmb} and {res_info.yr} = {?acyer} and {res_info.etype} = {?etyp} it there in formula workshop-record selection formula editor. Please help me to get rid of this problem!

A: 

Yes you are right LittleBobbyTables. When I click on show report button it shows nothing(I dont get error message but getting no records back.) Yes I have written {res_info.stu_id} = {?idnmb} and {res_info.yr} = {?acyer} and {res_info.etype} = {?etyp} it there in formula workshop-record selection formula editor

James
James, have you tried modifying your report formula so that it only holds one of the conditions at a time, and then running it? If there is a fault with one of the conditions, this should help you find it; conversely, if all of the single-condition runs return data, it may simply be that there is no data in the data source that fulfils all of the conditions simultaneously.
Mark Bannister