The special variable 'Formula' must be assigned a value within the formula

Greetings...I'm new to crystal and trying to execute the following code to color a textbox, but I get "The special variable 'Formula' must be assigned a value within the formula". What can I do to resolve this?

Scott

If {Total}  <  ({Average}/2) Then
crRed
ElseIf {Total}  >=  ({Average}/2) And {Total}  <  {Average} Then
crYellow
ElseIf {Total}  >=  {Average} Then
crGreen
End If
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Author Commented:
sorry...v!0 connected to MS SQL 7.0 on Win2k
0
Commented:
If you're using Basic syntax in your formulas, you have to explicitly state 'Formula = x':

If {Total}  <  ({Average}/2) Then
Formula = crRed
ElseIf {Total}  >=  ({Average}/2) And {Total}  <  {Average} Then
Formula = crYellow
ElseIf {Total}  >=  {Average} Then
Formula = crGreen
End If

-dave
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Commented:
You must have the syntax set to Basic in the drop down in the upper right of the formula workshop.
Change that drop down to Crystal syntax and that should clear up that error.
0
Author Commented:
Thanks, Dave...that looks like it got it...appreciate the quick response!
0
Author Commented:
I was using the Basic syntax, but missed explicitly stating the formula.
0
Commented:

-dave
0
Commented:
If I switch to Basic Syntax and type "Formula = {crBodyText}

the result is "This field name is not known." yet I am pretty sure this field (crBodyText) does exist in the report!
0
Commented:
Sorry - posted to wrong question - PLEASE IGNORE!!    :D
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.