The date ranges should be made in Crystal Reports as parameters and the Record Selector to apply these parameters as a filter for your records.

Once you have the Crystal Report so you can run it, apply your criteria and get back what you want then you can set up the display page.

I use 2 pages; one to collect the parameters and one to display the page.

The process I use, as an overview, is

  1. Create the object
  2. Create and apply the parameters
  3. Export the report to a temporary location (as a .pdf)
  4. Display the report to the user
  5. Remove the .pdf file

Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Dim crpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument

Dim paramFields As New CrystalDecisions.Shared.ParameterFields
Dim paramField As New CrystalDecisions.Shared.ParameterField
Dim dVal As New CrystalDecisions.Shared.ParameterDiscreteValue

' I use a session variable to store the object
crpt.Load(objReport.ReportFullName, OpenReportMethod.OpenReportByDefault)

'Parameters
Dim pvParamValues As ParameterValues
Dim dvDiscreteValue As New ParameterDiscreteValue

pvParamValues = crpt.DataDefinition.ParameterFields(<<parametername>>).CurrentValues
dvDiscreteValue.Value = <<parametervalue>>
pvParamValues.Add(dvDiscreteValue)
crpt.DataDefinition.ParameterFields(<<paramtername>>).ApplyCurrentValues(pvParamValues)

'Log in
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
For Each myTable In crpt.Database.Tables
    myLogin = myTable.LogOnInfo
    myLogin.ConnectionInfo.ServerName=<<servername>>
    myLogin.ConnectionInfo.DatabaseName=<<database>>
    myLogin.ConnectionInfo.Password=<<password>>
    myLogin.ConnectionInfo.UserId=<<userid>>
    myTable.ApplyLogOnInfo(myLogin)
Next

'Export
Dim crExportOptions As New ExportOptions
Dim crDiskFileDestinationOptios As New DiskFileDestinationOptions
Dim fname As String = ""
Dim gFileId As New Guid

fname=<<wheretosavefile>> + gFileId.ToString + ".pdf"
crDiskFileDestinationOptions.DiskFileName=fname

crExportOptions = crpt.ExportOptions
crpt.ExportOptions.DestinationOptions = crDiskFileDestinationOptios
crpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
crpt.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat

crpt.Export()

'Display and Cleanup (comment out to debug)
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(fname)    'writes out PDF if created

'Cleanup
Response.Flush()
Response.Close()
System.IO.File.Delete(fname)



Unfortunately I have to leave until tomorrow. Have fun!