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!

need help with date parameter 1

Status
Not open for further replies.

ncchish

Programmer
Jul 29, 2002
86
US
I need a parameter that displays a date range but only shows month and year. I need to be able to go back at least 2 years or run it for say a month. May 2017 to June 2018 or April 2018 to April 2018 are 2 examples. Crystal dates show the day in the parameter and we can’t allow the user to select the day but only a month and year. Any help is appreciated. Thanks.


I had this set up with the parm set to a number and allowing a range but it gives an error if you try to check for a range like May 2017 to March 2018
(({CLNDR_MNTH}) in {?month-range}) and
//(PRODYR} in {?year-range}) and
 
The simplest approach would be to ask the user to select ANY date in the beginning month and ANY date in the ending month, letting them know that the report will always start on the first of the starting month and end on the last day of the ending month. Then you would just use a formula like this:

{table.date} >= date(year({?start}),month({?Start}),1) and
{table.date} < dateserial(year({?end}),month({?end})+1,1)

Note the dateserial in the second part of the formula.

If you really must have users choose the month and date, you can hardcore the start date into the values list of the start parameter and the month/year in the description list. Repeat for the end date parameter.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top