Error message when trying to edit Sage 300 Certified Payroll report

SOLVED

I am using Crystal Reports 2008 to edit the Sage 300 Certified Payroll report (UP71A/ENG/upcprj1.rpt).  When I open the file in Crystal, it first gives the error message, "The saved data will be discarded since one or more formulas failed to compile."

When I try to show the SQL query for the report, I get another error, "The ) is missing."  This error shows up in the "fromDate" field, and the formula looks like this:  

if trim({?WEEKSTART}) = "" or ToNumber({?WEEKSTART}) = 0 then " "
else ToText(pwFormatDate(ToNumber({?WEEKSTART})))

The pwFormatDate function is highlighted, so I assume the error is there, but at first glance, the formula looks fine to me (i.e., parentheses are balanced).

This happens when I try to edit the report as it was initially installed, so I don't know what the problem is here.  Any ideas?