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

Date Parameter Default prompt of CurrentDate 1

Status
Not open for further replies.

CathB

Programmer
Mar 30, 2004
1
FR
Using Crystal V.6, I want my date parameter to have a default prompt of today's date. The report will normally be run for the current day. The prompt insists on a format of Date(2001, 03, 02). How can I use CurrentDate to show in the prompt?
 
Cath,
Crystal Reports - Integration/Distribution
forum768 is probably a better place to ask this question Malcolm
 
Sorry Cath - I read/imagined your post to be "Crystal using VB6", not "Crystal V.6".
Crystal Descisions: CR Formulas is probably the better spot.
However, instead of using a date parameter, you could use a string parameter, and you could allow the user to type in "Today" etc (or make it your default value), and then convert that to a date with the following formula.
This formula also includes a function to convert strings to dates DTSToDate() which I don't believe was around in V6 - you'll have to eliminate that line, or use a rather convoluted method of converting it to a date (that I hope you are familiar with ;-) ).
//record selection formula
DateVar PromptDate;
If {?Prompt} = Tomorrow then
PromptDate := (DataDate + 1)
Else
If {?Prompt} = Yesterday then
PromptDate := (DataDate - 1)
Else
If {?Prompt} = Today then
PromptDate := (DataDate)
Else
PromptDate := (DTSToDate({?Prompt}));
{field.date} = PromptDate
Malcolm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top