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!

Using Select Case as a formula

Status
Not open for further replies.

Me2500

Programmer
Aug 3, 2007
7
US
I am trying to use Select Case to set the value of a variable called LimitPct. It is the percentage limit of an invoice quantity over the PO quantity we will accept. It is different for different vendors plus the may be ranges we negotiate for a given vendor. I prefer Basic Syntax b/c that is where my experience lies. My code is :

Rem Select Statement to determine Limit Vendor may exceed order
Rem Must be updated for each Vendor
Rem This method is preferrable to a table b/c of the complications of
Rem maintaining a table in MRP or on the server. IF there is a lot of
Rem vendors we'll evaluate using a table
Select Case {AP_Document.Vendor}
Case "STEIND"
Select Case {PO_Detail.Order_Quantity}
Case Is < 100
Formula = .10
Case Is < 1000
Formula = .03
Case Else
Formula = .02
End Select
Case Else
Formula = .03
End Select

I am trying to put this in the formula editor. I am getting the error message "The current formula cannot be used with the formula expert".

How do I accomplish this task? Am I correct in setting it up as a formula field? If not, where do I put the code?

Thank you very much for your help
 
Make sure you are set to use VB syntax and not crystal syntax. This is a global setting.

Also be sure and post your crystal version, the correct answer to your questions will vary based on your version.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
If you hold down the Alt and X key to change between the expert and the editor, paste your code into the editor.
 
In the formula editor, change the setting to "Basic Syntax". When I tested your formula after making this change, there were no errors.

-LB
 
Thank you very much!

I needed to switch to Basic Syntax before writing the code. I never would have guessed that!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top