Dim crxApplication As New CRAXDRT.Application Public oReport As CRAXDRT.Report Public cboRpt1, cboRpt2 As String Public start_date, end_date As String Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If cboRpt1 = 0 And cboRpt2 = 0 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) oReport.ParameterFields.Item(1).AddCurrentValue(CDate(F1.TextBox2.Text)) oReport.ParameterFields.Item(2).AddCurrentValue(CDate(F1.TextBox3.Text)) ElseIf cboRpt1 = 0 And cboRpt2 = 1 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) oReport.ParameterFields.Item(1).AddCurrentValue(CDate(F1.TextBox2.Text)) oReport.ParameterFields.Item(2).AddCurrentValue(CDate(F1.TextBox3.Text)) ElseIf cboRpt1 = 0 And cboRpt2 = 2 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) oReport.ParameterFields.Item(1).AddCurrentValue(CDate(F1.TextBox2.Text)) oReport.ParameterFields.Item(2).AddCurrentValue(CDate(F1.TextBox3.Text)) ElseIf cboRpt1 = 1 And cboRpt2 = 0 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) ElseIf cboRpt1 = 1 And cboRpt2 = 1 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) ElseIf cboRpt1 = 1 And cboRpt2 = 2 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) ElseIf cboRpt1 = 1 And cboRpt2 = 3 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) oReport.ParameterFields.Item(1).AddCurrentValue(CDate(F1.TextBox2.Text)) oReport.ParameterFields.Item(2).AddCurrentValue(CDate(F1.TextBox3.Text)) ElseIf cboRpt1 = 1 And cboRpt2 = 4 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) oReport.ParameterFields.Item(1).AddCurrentValue(CDate(F1.TextBox2.Text)) oReport.ParameterFields.Item(2).AddCurrentValue(CDate(F1.TextBox3.Text)) ElseIf cboRpt1 = 2 And cboRpt2 = 0 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) ElseIf cboRpt1 = 2 And cboRpt2 = 1 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) ElseIf cboRpt1 = 2 And cboRpt2 = 2 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) ElseIf cboRpt1 = 2 And cboRpt2 = 3 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) ElseIf cboRpt1 = 2 And cboRpt2 = 4 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) ElseIf cboRpt1 = 2 And cboRpt2 = 5 Then oReport = crxApplication.OpenReport("c:\crystal_test.rpt", 1) End If crViewer.ReportSource = oReport crViewer.ViewReport() End Sub