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

Problem with prompting for date range

Status
Not open for further replies.

nineiron

Programmer
Mar 28, 2007
4
US
I want to prompt the user for a date range, but allow the user to enter the dates manually rather than from a dropdown.
Any thoughts?
 
This is not that hard to do. The most common method is to allow users to use the GUI calendar that appears in both CE/BOE and CR. However if editing/entering dates manually is your desire, then in CR ver 10 and prior, ensure the parameter is set to "Allow Editing of default values". If running version XI ensure allow custom values is set to true.

 
Still got problems. I am using CR,XI.
I have a parameter field, date. I changed the Option to allow discrete values. When I preview the report a prompt comes up, but doesn't allow me to enter manually.
Should I be using a parameter field?
 
Yes a parameter field is the easiest way to prompt a user for input.

When you choose "allow discrete values - True" Crystal toggles the "allow range values" to "False". Meaning you will only be prompted for a single date value.(You cannot have discrete and range set to true, one or the other)

The other setting "allow custom values" must be set to "True" to allow the user to manually enter a value.

Check to see that the parameter field has a green tick showing against it in the Field Explorer. If not then you have not used the parameter field in the report.

The parameter field should be used in the record selection of the report ie {DateField} = {?DateParameterField}

I hav just created a test report with a date type parameter and it prompts me to "Please enter Date in format "yyyy-mm-dd" I can type in a date in yyyy-mm-dd format.



 
I tried to put {Command.date}={?DateRange} in the record selection but it said I need a date field. Also, how would I enter a date range, i.e. 3/12/2007 thru 3/20/2007. Should it be a formula, between xxxx and xxxx?
 
OK. It sounds like you have a data type mismatch on your parameter field. Open it up and ensure it is set to a Date type field.

Also ensure it is set to "Allow Range of Values" - True.

The Record Selection formula of {Command.date}={?DateRange} should work if you have set the parameter up as I have described above.

Once setup up as above, when you refresh the report, you should see a prompt asling for a date range in the format yyyy-mm-dd to yyyy-mm-dd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top