Question : How do I use RecordSelectionFormula to pass dates via VS 2005 to Crystal report 2008?

Hi,

I am having a strange problem in Crystal report 2008. Earlier I was using VS 2005 Crystal report. Then we purchased Crystal report 2008.

When I opened the VS 2005 projects it asked reports to convert into Crystal report 2008. I did that.

Earlier I was using the following syntax for passing the date as selectionFormula

Dim selectionFormula As String = "{tblClient.Name} = '" & ddlClient.SelectedItem.Text & "' and {TBILL_File_Format.Week Ending Date} = #" _& Convert.ToDateTime(DtCtrlProDateFrom.DateTimeValue) & "# WeeklyReportByClientNameReport.DataDefinition.RecordSelectionFormula = selectionFormula

But now when I run this same it says

This field name is not known. Details: errorkind Error in the file rptWeeklyReport.rpt: Error in formula Record_selection:  

{tblClient.Name} = 'ABC10' and "{TBILL_File_Format.Week Ending Date} = #04/20/2008# This field name is not known. Details: errorkind

I have no idea about this
Even If I tried to pass as follows
selectionFormula = "{TBILL_File_Format.Week Ending Date} = DateTime (2008, 04, 25, 00, 00, 00) and {TBILL_File_Format.Client Code} = 'ABC10' "
I couldn't see any record on the report except Grouptree of the report. If I export the report it has all the data as I expected.

Please help me out on this regards.

Thanks in advance

Saravanan

Answer : How do I use RecordSelectionFormula to pass dates via VS 2005 to Crystal report 2008?

We used something like

'{MyDateTimeField} = DateTime(Date(' & Year(DateField) & ',' & Month(DateField) & ',' & Day(DateField) & ', Time(0,0,0))'

I don't know if CR 2008 works with VS2005.  It should but they have changed some of the methods and I don't have any development tools.

I understand the CR.Net2008 is still based on CR10 so you should be able to use the report as you do CR.Net2005 reports.

mlmcc
Random Solutions  
 
programming4us programming4us