Results 1 to 5 of 5

Thread: [RESOLVED] Comparing two dates. vb.net 2005

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2006
    Posts
    62

    Resolved [RESOLVED] Comparing two dates. vb.net 2005

    I have this formula in my Crystal Report Select Expert
    Code:
    {WorkOrder.WODate} >= dateTimeVar fromdate and
    {WorkOrder.WODate} <= datetimevar todate
    Fromdate and Todate comes from two DateTimePickers.

    I don't get an error but there's no output to the report.
    Anyone knows what need to be done to make it work?
    Is there a way to debug Crystal Report?

    Thanks,
    Pierrewhy

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

    Re: Comparing two dates. vb.net 2005

    You are declaring local variables but not setting them to a value. If FromDate and ToDate are Parameters the formula should be

    {WorkOrder.WODate} >= {?fromdate} and
    {WorkOrder.WODate} <= (?todate}

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2006
    Posts
    62

    Re: Comparing two dates. vb.net 2005

    Thanks for your help,
    I have them declare in a module this way.
    Code:
    Public FromDate As Date
    Public ToDate As Date
    You example gave me "This field name is not known".

    Where should they be declared?
    Thanks,
    Pierre

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

    Re: Comparing two dates. vb.net 2005

    Typically the Report would contain parameters. Crystal appends the question mark to parameter field names, ie ?FromDate. You can then use the parameter fields anywhere in your report like formula or database fields, like the code I posted earlier.

    Once you add parameters to a report, Crystal will prompt the user for their values unless you overide the default screen. In your case you would simply set the parameter values = to the datapicker values or your variables declared in the module.

    I don't use Crystal with .Net so can't comment on the required code...

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2006
    Posts
    62

    Re: Comparing two dates. vb.net 2005

    This work fine....Thanks for your help.
    Pierre

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