First post:
I followed the example from page 296 (.net 2005/2008) listing 15-1, it generated an error stating that the formula was not a string.
So I put single quotes into the formula, then got a different error. This time stating that the result must be a boolean.
I am just trying to select records where deposit date falls within a range of dates. When I remove the selection formula the report displays in the viewer or prints via printoprinter...
I entered the code into the selection formula imbeded in the report that worked just fine. Next I copied the selection formula from the editor. The resulting error message when I run the code contains the exact same value as the formula.
db as env:
SQL Server 2008, VS 2008 the table is flat for this report nothing complex.
Data structure:
Check No, Check Date, Deposit Date, First Name, Last Name, Check Amount
Code follows:
Dim sFrom As String
Dim sTo As String
With DateTimePicker1.Value
sFrom = .Year.ToString & "," & .Month.ToString.PadLeft(2, Chr(48)) & "," & .Day.ToString.PadLeft(2, Chr(48))
End With
With DateTimePicker2.Value
sTo = .Year.ToString & "," & .Month.ToString.PadLeft(2, Chr(48)) & "," & .Day.ToString.PadLeft(2, Chr(48))
End With
Dim sb As New StringBuilder
sb.Append("'{Payment_History.Deposit_Date} in (Date(")
sb.Append(sFrom & ") to Date(")
sb.Append(sTo & "))'")
Dim myReport As New CrystalReport2
myReport.DataDefinition.RecordSelectionFormula = sb.ToString
CrystalReportViewer1.ReportSource = myReport
Edited by DoubleNickel - 16 Oct 2009 at 12:12pm