Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: need help w/date range selection error Post Reply Post New Topic
Author Message
DoubleNickel
Newbie
Newbie
Avatar

Joined: 13 Oct 2009
Location: United States
Online Status: Offline
Posts: 1
Quote DoubleNickel Replybullet Topic: need help w/date range selection error
    Posted: 15 Oct 2009 at 12:17pm

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
bought for a price
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.