Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I show report between two dates? I have shown report by ID number through parameter. To do it I had one text box & one report viewer & button. But now I have two text boxes to write two different date one button & one report viewer. What should I do to show report between two dates?

My code :
VB
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form6
Inherits System.Windows.Forms.Form


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'Dim cryRpt As New ReportDocument
'cryRpt.Load(Application.StartupPath & "\CrystalReport5.rpt")
'CrystalReportViewer1.ReportSource = cryRpt
'CrystalReportViewer1.Refresh()

Dim cryRpt As New ReportDocument
cryRpt.Load(Application.StartupPath & "\CrystalReport5.rpt")

Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue

crParameterDiscreteValue.Value = TextBox1.Text
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("id")
crParameterValues = crParameterFieldDefinition.CurrentValues

crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
cryRpt.RecordSelectionFormula = "{Button1}= " & TextBox1.Text & ""
End Sub
Please tell me what should I write now to show record between two dates?
Posted
Updated 17-Jul-10 18:13pm
v2
Comments
Christian Graus 17-Jul-10 19:33pm    
Surely there's online tutorials on the basics of using Crystal Reports ?

1 solution

Have a look at these tutorials to get basics of Crystal report:
Dynamic Crystal Report with C#[^]
Dynamic Crystal Reports Viewing[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900