1
votes

I have crystal reports and in formula editor, based on date.

If {?PDATERANGE1} <> "" AND {?PDATERANGE2} <> "" Then
    ToText(DateValue({?PDATERANGE1}), "MMM d, yyyy") & " - " & ToText(DateValue({?PDATERANGE2}), "MMM d, yyyy")

I am calling this from ASP and PDATERANGE1 and PDATERANGE2 are "10/10/2001" and "10/12/2001".

I am getting the following error.

Bad date format string. Details: errorKind Error in File {B6624BE5-D6DA-469B-A635-9FE86B125492}.rpt: Error in formula dt_range: 'If {?PDATERANGE1} <> "" AND {?PDATERANGE2} <> "" Then ' Bad date format string. Details: errorKind

Could someone please tell me what is wrong? I am not a crystal reports developer.

2
not sure, that date format string works for me.dotjoe
@kalls: Are you setting the values to be 10/10/2001 and 10/12/2001, or "10/10/2001" and "10/12/2001" ?user359040
@MarkBannister My money is on this being the culprit. Might want to add as an answer.Ryan

2 Answers

1
votes

If the values of {?PDATERANGE1} and {?PDATERANGE2} include double quotes - so that they are "10/10/2001" and "10/12/2001" respectively - then these double quotes need to be removed (so that they become 10/10/2001 and 10/12/2001 respectively).

0
votes

I think it's because "" is not a valid date. Are the paramaters optional and you're checking whether they have values?

In crystal you have to use function hasvalue({?parameter}) though optional parameters tend to cause real issue so i avoid them like the plague!