Go4Expert (http://www.go4expert.com/)
-   MS Access (http://www.go4expert.com/forums/ms-access-forum/)
-   -   if statement or switch case (http://www.go4expert.com/forums/statement-switch-t10199/)

 edreamers 23Apr2008 20:04

if statement or switch case

I am working on a tax calculation program. i want to use multi if statement in the manner below:-

if sex=Male
and income>110000 and income<=150000
then tax=(income-110000) *10

elseif if sex=male
and income>150000 and income<=250000
then tax=(income-150000)*20+4000

elseif sex = male
and income>250000
then tax(income-250000)*30+24000

Please tell what will be the proper syntax for this problem in access and where to write this code.

 DonCarmelo 14Dec2009 00:13

Re: if statement or switch case

Hi

You would have to create a module by clicking on module on the left of the window. This allows you to write vba (Visual Basic for Applications) code. Create a function called TaxCalc or anything else you want to name it and make it public. That way it can be reached by queries, etc.

Public Function TaxCalc(Income as single) as single