Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Formula Field

Status
Not open for further replies.

Sarav

Programmer
May 24, 2001
5
GB
Hi folks,

I am using a formula field (@age) to calculate age in my report,

Datediff("yyyy",{vwPat.Pat_DOB},CurrentDate)

which gives me age properly in the preview of the report,
BUT,
When i call the same report from my Visual Basic Application
it throws an error saying..

*-----------------------------------------------------------
Error in formula <age>
'Datediff(&quot;yyyy&quot;,{vwPat.Pat_DOB},CurrentDate)
'
The remaining text does not appear to be part of the formula
*-----------------------------------------------------------

I tried changing the report from &quot;crystal syntax&quot; to &quot;basic syntax&quot; also....but still I dont find any solution....please help me in this regard....Thanks in advance......




 

I believe you need to change the double quotes around yyyy to single quotes. Can you post the code where you actually pass the formula?
 
I tried with single Quote also but it gives the same error.....

anyway here is the code i am using to call the report from my VB Application

crpPrintRP.ReportFileName = &quot;C:\MyApp\MyReport.rpt&quot;
crpPrintRP.Destination = crptToWindow
crpPrintRP.SelectionFormula = &quot; {vwPat.Pat_Seq} = &quot; & Val(lvwPatient.ListItems(intI).SubItems(5))
crpPrintRP.Action = True
crpPrintRP.Reset

age is the formula field i have in the report ....when i delete the age-formula field it works fine......problem comes only when i insert the formula field.....

where am i going wrong.???.....

waiting for ur reply.....

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top