
Problem applying record selection formula
I am using CR .NET with ASP.NET. I'm using the CR ReportDocument
object to load the report, set the selection formula, and export the
report to PDF. The problem is that no matter what the selection
formula, the exported report displays all the records.. My code is
listed below...
--------
--------
Dim crReport As New ReportDocument(), thisdate As Date, enddate As
Date
Dim fname As String, rsf As String
Dim crDest As New DiskFileDestinationOptions()
Dim crExp
thisdate = calSelect.SelectedDate
enddate = DateAdd("d", 6, thisdate)
rsf = "{qry_ShowReserved.DateStart} IN #" & thisdate & "# TO
#" & enddate & "#"
crReport.RecordSelectionFormula = rsf
fname = "d:\inetpub\rpttemp\" & Session.SessionID.ToString &
".pdf"
crDest.DiskFileName = fname
crExp = crReport.ExportOptions
crExp.DestinationOptions = crDest
crExp.ExportDestinationType = ExportDestinationType.DiskFile
crExp.ExportFormatType = ExportFormatType.PortableDocFormat
crReport.Export()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(fname)
Response.Flush()
Response.Close()