Question : DTSToDate Syntax Error?

I'm new to Crystal, so I am probably missing something obvious.  Anything wrong with this formula?

if DTSToDate({History.DATE}) in {?DateRange} then
  {History.COST} * {History.DISTRIBUTE}
else
  0

It works fine in the Crystal 7.0 Pro developer, but when I try to run it within a VB app using 8.0 DLLs, I get the following error:

Run-time error '20515':
Error in file C:\...\myreport.rpt:
Error in formula .
If DTSToDate({History.DATE}) in {?DateRange} then
'
A number, currency amount, boolean, date, time, date-time, or string, ?developr.hlp

Answer : DTSToDate Syntax Error?

The formula looks valid in both versions, but apparently the formula is being interpreted differently by the runtime environment.  So here are some troubleshooting tips:

Can you try running the report in the  V8 designer on the same PC as the App?   Where did the 8 dll's come from?

Are you using the RDC (Active X designer )to launch the report?  Not all techniques can handle range value parameters.   You might need to use 2 parameters (start date - end date) with a between comparison.

Try using an = sign here and see if that allows the report to run the same in V7. See if that has impact in V8.

However, it might be that the "Additional Function" you used is not availble at runtime.  This is the function DTSToDate.  

One option to try is to change the Report Options for this report.("File - Report Options")  On the Reporting Tab convert DateTime to Date.  Now you should be able to drop the function from the formula.

Of course this will affect other areas of the report. Make the changes so the report will run again in V7.  Now see if it runs in V8.

Good Luck
Random Solutions  
 
programming4us programming4us