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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating a Date parameter - how do you?

Status
Not open for further replies.

redeemasp

Programmer
Jun 1, 2004
63
GB
I have a start date parameter and end date parameter, and I want to stop users entering a start and end date that is greater than 1 months (or 28 days).

I know how to do this in VB.Net, but not sure how to within Crystal Language. Is there an easy way, or is it a big function?

Thanks

Redeem.
 
One method would be to use a start parameter, and instead of an end parameter, use a number parameter that defines the number of days. When setting up the discrete number parameter, go to Set Default->Range Limited Field and set the minimum and maximum to 0 and 28 respectively. The record selection formula would then look like:

{table.date}in {?startdate} to {?startdate} + {?numberofdays}

-LB
 
Or you might overide the date range value when this occurs using something like:

if maximum({?daterange})-minimum({?daterange}))< 29 then
(
{table.date}>= minimum({?daterange})
and
{table.date}<= maximum({?daterange})
)
else
(
{table.date}in {?startdate} to {?startdate} + 28
)

Then place some text within the report to state that their values were overridden.

Unfortunately Crystal won't let you check 2 dates and force reentry if the values are out of range.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top