|
-
May 10th, 2006, 11:54 AM
#1
Thread Starter
Hyperactive Member
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?
On Error GoTo http://www.vbforums.com
Note :
1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.
-
May 10th, 2006, 12:22 PM
#2
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.
-
May 11th, 2006, 04:10 AM
#3
Thread Starter
Hyperactive Member
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 ?
On Error GoTo http://www.vbforums.com
Note :
1) Please use [vbcode]your code goes in here [/vbcode] tags when posting VB code.
2) Please mark thread as Resolved using the Thread Tools menu, if you got solution.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|