RecordSelectionformula ?????
Hello All,
I am using CR9 & Access database.
Now I want to give record selection formula for perticular report in date range manner through VB code.
Its working fine for other date ranges but if I put date range from system date to system date then its not showing me any records rather I am getting records from query.
I have following ways to get preview of report:
VB Code:
1) oReport.RecordSelectionFormula = "{SPDelhiWise.RegDate} >= date(" & Format(fromdate, "yyyy,mm,dd") & ") and {SPDelhiWise.RegDate} <= date(" & Format(todate, "yyyy,mm,dd") & ")"
OR
2) oReport.RecordSelectionFormula = "{SPDelhiWise.RegDate} > CDate(#" & fromdate & "#) AND {SPDelhiWise.RegDate} < Cdate (#" & todate & "#)"
now how should I handle it for range of same date? :wave:
Re: RecordSelectionformula ?????
You need to consider the Time portion of date fields. Regardless, this formula
oReport.RecordSelectionFormula = "{SPDelhiWise.RegDate} In CurrentDate"
Returns all records for today. Following is the SQL Query Crystal executes - I used the Northwind database and set the formula to {Orders.OrderDate} In CurrentDate
Code:
SELECT
Orders."OrderID",
Orders."OrderDate"
FROM
Northwind.dbo.Orders Orders
WHERE
Orders."OrderDate" >= {d '2006-05-10'} AND
Orders."OrderDate" <= {ts '2006-05-10 23:59:59.000'}
Note: The query generated by Crystal will depend on the database and connection method.
Re: RecordSelectionformula ?????
still its creating a problem.... :(
Tell me one thing what is syntax/formula to calculate records between two date range in crystal report ?