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

how to apply a function 1

Status
Not open for further replies.

charanch

Programmer
Jan 3, 2004
55
US
Hi there, this is probably too complicated to post but this forum is so helpful, maybe somebody can point me in the right direction. I'm converting an application that allows the user to create lumber orders. There are 5 different formulas to determine pricing, i.e. SF, MBF, CSF, etc. Each item number has one of these codes associated with it. I have cracked the formulas, but do not know how to apply them when a user creates an order, they will choose from the list of items. As they add the item, I have to calculate the price based on the formula which adds the result to the orders table. Can I do this with CASE? How would I call a function to do what I'm trying to do? Any help would be greatly appreciated. I really don't know where to start. Thank you.
 
CASE should work fine if I'm reading you right. You could write a function if you want but I'm not sure that it's necessary.
Pseudo-Code
Code:
strSql="SELECT Price,calcMethod FROM myTable WHERE itemNumber='" selectedItem & "'"
.......

price = rs("Price")
calcMethod = rs("calcMethod")

SELECT CASE calcMethod
   CASE "SF"
        'perform SF calculation on price variable         
   CASE "MBF"
        'perform MBF calculation on price variable
   CASE "CSF"
        'perform CSF calculation on price variable
END SELECT
 
Outstanding, Veep. I'll give it a try. Thanks.
 
Hello Veep, just wanted to let you know your idea works spendidly. I really appreciate your help. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top