Error in Formula Field not known

jccorner

Well-known member
Joined
Jan 31, 2004
Messages
144
Crystal reports drives me absolutely bonkers with issues like this. My problem is that Ive created a crystal report that is located on the server in which the report source is a stored procedure from MSSQL. Now I have two parameter fields Start and End along with some formulas. The issue is that if I set the report up like thus:

Code:
crReportDocument.Load(rptPayrollTransmittal)
crReportDocument.SetParameterValue("@Start", CDate(txtStart.Text))
crReportDocument.SetParameterValue("@End", CDate(txtEnd.Text))
crReportDocument.SetDataSource(dsPayroll.Tables(0))

I get a problem with the formula field saying that the parameters Start and End are not known. So I changed the code to pass in the parameters to the report using its datadefinitions using examples I found on the web but now I am receiving this error:

Error in formula <Total>
IIF ({spPayrollTransmittal;1.SalaryType} = H, {spPayrollTransmittal;1.Regular} + {spPayrollTransmittal;1.Overtime}, 40)
This field name is not known.

This tells me that Im successfully passing the parameters but now that Im not physically setting the datasource, its as if it doesnt recognize the db fields. Funny thing is the report runs fine in the designer. Now Ive tried playing with the code, by incorporating both methods and even hard coding my parameters just to see if the report would run (which it did succesfully). My problem is how do I pass parameters to my report which I want to run from the server without the above error??

Thank you very much for any help you can give me, Ive been hacking at this for two days now without any luck.
 
Interesting...

I did some more research and got the idea to recreate the same report in the report designer of VS.Net. Recreated the report and it works using the dataset I created and am filling in the code. So great right?? Wrong, now when I go back to the CR designer with the recreated report, its looking for the datasource which happens to be a manually created dataset table in the project and gives me an error when trying to bring up the report.

So, Im still stuck because its just not logical to have to make two reports everytime I have to create a report, one for the CR users and one for the VB app. If anyone has figured this issue out or has some advice, I would love to hear it.
 
Back
Top