A date-time is required here. Crystal Report

I am passing the record selection forluma using the following code:
 report.DataDefinition.RecordSelectionFormula =
"{trans_dtl_conso.transaction_date}='" & Format(dtpFrom.Value, "MM-d-yyyy")  & "'"

Following error message appears:
A date-time is required here.
Error in File ...report file name dot rpt;
Error in formula <Record_Selection>.
'{trans_dtl_conso.transaction_date}='03-1-2006'
A date-time is required here.

datastruce of transaction_date is datetime in sqlserver.
I want to validate only the date.
peterdevadossAsked:
Who is Participating?
 
g_johnsonCommented:
within crystal you probably need to use #03-1-2006# to pass the date; you are just passing a formula to crystal, crystal is talking to sql
0
 
Brian CroweDatabase AdministratorCommented:
johnson is correct try...

report.DataDefinition.RecordSelectionFormula =
"{trans_dtl_conso.transaction_date}=#" & dtpFrom.Value.tostring("MM-d-yyyy")  & "#"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.