Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Parameter Range Problem

Status
Not open for further replies.

franklin1232

IS-IT--Management
Aug 29, 2001
207
US
I am using a sql sever that has a datetime field I would like to use in my record select. So I create a datetime parameter field and add it to my select statement. The problem is that as soon as I set the parameter to allow ranage vales and the select to be "is between" the formula produces an error: "a date is required here."

Formula: {database.Posting Date} in CDate ({?Par Date Range}) to CDate({?Par Date Range})

I tried all different conversion functions which I shouldn't need at all because the datatypes match, but if I allow date ranges I get the error. With out ranges I just get the one days worth of info. Bug?

Using Crystal XI
 
If your field is a datetime and your parameter is a datetime range, then you don't need cdate(),and you can use:

{database.Posting Date} = {?Par Date Range}

If you want the parameter to be a date, then set it up as a date, and use:

date({database.Posting Date}) = {?Par Date Range}

-LB
 
That's what I tried first and it doesn't work either. All the date conversion functions and no date conversion function works. It errors when I allow range values only.

If I just needed one date I can make it work.
 
Please try my first suggestion (again) and then report back. I can't see any reason why this wouldn't work.

-LB
 
Here is what I have noticed. DateTime parameters do not show in the select options when choicing "is between". I need to use date ranges so I set the parameter to date. Tried datetime and date without any conversions but still error when using "is between". I tried to convert date to datetime but same error. Like I said before though, If I don't allow range values in the parameter I don't get an error, but I don't get the data I need.
 
is between" is not appropriate for range parameters. Please create the parameter as a range parameter, of datetime type, and then go to report->selection formulas->record and enter the following:

{database.Posting Date} = {?Par Date Range}

Do not use the selection expert.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top