0
votes

Using Crystal Reports version 8. Trying to restrict data retrieved based on date range provided by the user.

Here is the formula I am trying to use in the Select Expert:

{Query.current0} <> 0.00 and
{Query.status} in ["PIF", "SIF"] and
{Query.closed} >= DateTime ({?Start}, Time (00,00,00)) and
{Query.closed} <= DateTime ({?End}, Time (23,59,59))

When I click the error checking button, CR gives the error "A date-time is required here" and puts the cursor at the end of the second line after the "and".

I have confirmed both {?Start} and {?End} are Date parameters and they do have data in them. {Query.closed} is a datetime in the original database, and if I remove the {Query.closed} date restrictions, the report runs fine (it just pulls all the data in the database!).

Oddly enough, I have another Crystal Report that runs just fine using this formula in the Select Expert:

{Collect2000Log.LogWhen} >= DateTime ({?FromDate}, Time (00,00,00)) and
{Collect2000Log.LogWhen} <= DateTime ({?ToDate}, Time (23,59,59))

In both reports, the parameters involved are Date parameters, and both {Collect2000Log.LogWhen} and {Query.closed} are datetime fields. One major difference is the PIF/SIF report (the one with the errors) is built on a saved Crystal SQL Query and the one without errors was not.

Can anyone help me spot what I am missing?

1

1 Answers

0
votes

After further exploration, I'm not sure what the actual issue was, however I re-created the report WITHOUT the use of Crystal SQL Queries and it is now pulling data just fine. Would appreciate knowing the details if anyone can explain, but for now mystery is solved!