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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If Then Formula

Status
Not open for further replies.

Rob2k2

Technical User
Oct 14, 2002
36
0
0
GB
Okay, here it goes:-

I need to replicate this code in crystal in order to avoid having a divide by zero error as TNoEnq can be 0

I have created a Formula called CPA in which I have the following code

If {@TNoEnq} = 0 Then
{@CPA} = 0
Else
{@CPA} = ({@Cost}/{@TNoEnq})*1000
End If

But it doesnt seem to let me reference the formula name from within the formula.

Anyone have any ideas on how to achieve this?

Thanks,

Robert


 
a formula can't refernce itself

just remove the reference as you are already setting the value of the formula i.e.

If {@TNoEnq} = 0 Then
0
Else
({@Cost}/{@TNoEnq})*1000

n.b. make sure oyur formula is set to use crystal syntax

HTH

Gary Parker
Systems Support Analyst
Manchester, England
 
Thanks a lot worked a treat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top