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?
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.