Link to home
Start Free TrialLog in
Avatar of diglife
diglife

asked on

Need to know how to write a "conditional query" in Access 97? : o /

Ok...i have a problem ...i have a query that generates a calculation in a field called Salesman Overage.  Below is the formula for the field:
Salesman overage: [Commissioncalc]-([Cabinet Net]+[Fin Mat'l])

This works fine as long as JobCost < ContractPrice.

What i need to do is be able to write something that says If the JobCost > Contract Price then i need it to run an alternate forumula that looks like this:

Salesman overage: [Total]-[ContractPrice]

Is there some sort of way to write this as a conditional if then statement in the query in that field?  In other words in the field where the query has this:
Salesman overage: [Commissioncalc]-([Cabinet Net]+[Fin Mat'l])

Replace it with something that would be equivelant to this:

If jobCost < Contractprice then
Salesman overage: [Commissioncalc]-([Cabinet Net]+[Fin Mat'l])
else
Salesman overage: [Total]-[ContractPrice]

I don't want to have to create any additional fields for this.  I'm very new to access so please be specific...Thanks!!

BTW..I'm working in Access 97

ASKER CERTIFIED SOLUTION
Avatar of flavo
flavo
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Salesman overage:  iIf (jobCost < Contractprice,[Commissioncalc]-([Cabinet Net]+[Fin Mat'l]), [Total]-[ContractPrice])
man, that was SUPER fast Dave !
1 minute... quite slow actually ;)
Oh Yeah, i know what you mean ;o)
unfortunatly EE doesn't show the "seconds" in the time.
Avatar of diglife
diglife

ASKER

jeez..that was quick...wish i could give ya all 500 for the help.

Thanks
Hey diglife

Welcome to EE,
you should see Dave when he is in his full capacity, like a bullet, fast and right to the target ;o)

jaffer
Glad to help diglife!

Thanks for the kind words jaffer, you 'ant too bad youself ;)