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>.
A date-time is required here.

datastruce of transaction_date is datetime in sqlserver.
I want to validate only the date.
Who is Participating?
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
Brian CroweDatabase AdministratorCommented:
johnson is correct try...

report.DataDefinition.RecordSelectionFormula =
"{trans_dtl_conso.transaction_date}=#" & dtpFrom.Value.tostring("MM-d-yyyy")  & "#"
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.