I have a table there in SQL SERVER 2000 which has five fields[date income amount expense amount]. Now user wants to input first date & last date there in form to show records ok? To show record by one paraemeter was easy for me & I did it by following code. I mean I made one parameter & got one form with one text box & one button & one report viewer. Let me show you my code for button event what I used to show report by one parameter.

Code :

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

But now I have created two parameter to show report. 

Parameter : {asst.dt} >= {?fdt} and {asst.dt} <= {?ldt}

fdt(first date & ldt(last date)

I have a form with two text boxes & one button & one report viewer. When user will input first date there in the first text box & last date there in last text box & click on show button it will show records between two dates including first date & last date. As a result I have wrtie code for button event right? I am using my previous code which is 

Code : 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 & "\CrystalReport1.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

but it doesnt work. Because it works for one parameter. Now would you please tell me what should I change or add there in my button event code to do what I am trying to do? Is it clear? For example user will input 1-1-2010 there in first text box & 30-1-2010 there in last text box when he will click on show button it will show record between 1-1-2010 & 30-1-2010 including 1-1-2010 & 30-1-2010. I hope you can understand it now. Please help me to solve this problem. I hope you will explain it to me properly because I am just a beginner.

please use code tagging.

Where are u setting the Date?

Could you please explain what you are doing? From what I can understand you are trying to get a report to show something from a start date to an end date.

I am tring to do a hyper link in crystal reports using My.Settings.
My.Settings + {procGetPackageForChangeNoticeReport;1.ProjectNumber}

Not working

deebailey1956 Please start a new thread

Try:

        Imports CrystalDecisions
        Imports CrystalDecisions.CrystalReports
        Imports CrystalDecisions.CrystalReports.Engine
        Imports CrystalDecisions.Shared

        Dim RptDoc As New ReportDocument()
        Dim CrTables As Tables
        Dim CrTable As Table
        Dim crtableLogoninfo As New TableLogOnInfo
        RptDoc.Load(Server.MapPath(ReportFullFilename))

                    With crConnectionInfo
                        .ServerName = "myServer"
                        .DatabaseName = "myDatabase"
                        .UserID = "myUserID"
                        .Password = "myPassword"
                    End WITH

        CrTables = RptDoc.Database.Tables

        For Each CrTable In CrTables
            crtableLogoninfo = CrTable.LogOnInfo
            crtableLogoninfo.ConnectionInfo = crConnectionInfo
            CrTable.ApplyLogOnInfo(crtableLogoninfo)
        Next

        RptDoc.SetDatabaseLogon(crConnectionInfo.UserID, crConnectionInfo.Password, crConnectionInfo.ServerName, crConnectionInfo.ServerName)


        RptDoc.SetParameterValue("FromDate", FromDatePicker.SelectedDate)
        RptDoc.SetParameterValue("ThruDate", ToDatePicker.SelectedDate)

        Dim stream As New BinaryReader(RptDoc.ExportToStream(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat))
        Response.ClearContent()
        Response.ClearHeaders()
        Response.ContentType = "application/pdf"
        Response.AddHeader("content-disposition", Convert.ToString("attachment; filename=") & downloadAsFilename)
        Response.AddHeader("content-length", stream.BaseStream.Length.ToString())
        Response.BinaryWrite(stream.ReadBytes(Convert.ToInt32(stream.BaseStream.Length)))
        Response.Flush()
        Response.Close()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.