Results 1 to 3 of 3

Thread: RecordSelectionformula ?????

  1. #1

    Thread Starter
    Hyperactive Member shirishdawane's Avatar
    Join Date
    Dec 2004
    Location
    Mumbai,India
    Posts
    363

    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. 1) oReport.RecordSelectionFormula = "{SPDelhiWise.RegDate} >= date(" & Format(fromdate, "yyyy,mm,dd") & ") and {SPDelhiWise.RegDate} <= date(" & Format(todate, "yyyy,mm,dd") & ")"
    2.  
    3. OR
    4.  
    5. 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.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    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.

  3. #3

    Thread Starter
    Hyperactive Member shirishdawane's Avatar
    Join Date
    Dec 2004
    Location
    Mumbai,India
    Posts
    363

    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
  •  



Click Here to Expand Forum to Full Width