Open your query in design view and paste these in the Field row of the grid.
Annnual Fees: IIF([Total Fees]= 0 OR [Mos]= 0, 0, ([Total Fees] / [Mos])*12)
Discount: IIF([List Price]= 0 OR [Total Fees]= 0, 0, ([List Price]-[Total
Fees])/[List Price]
Access Rate: IIF(FRP]= 0 OR [Total Fees]= 0 OR [Mos]= 0, 0, (12* [Total
Fees] / [Mos] / FRP)
The above returns 0 (zero) if there is a divide by zero error.
If you want a zero lenght string then use these --
Annnual Fees: IIF([Total Fees]= 0 OR [Mos]= 0, "", ([Total Fees] / [Mos])*12)
Discount: IIF([List Price]= 0 OR [Total Fees]= 0, "", ([List Price]-[Total
Fees])/[List Price]
Access Rate: IIF(FRP]= 0 OR [Total Fees]= 0 OR [Mos]= 0, "",(12* [Total
Fees] / [Mos] / FRP)
--
Build a little, test a little.
Heather said:
oops sorry - I put the names in to demonstrate what it was in Excel so you
weren't just seeing the excel formula - so here it T329 = Total Fees and
X329= Mos
:
Syntax for IIF ---
IIF(Test, Results for True, Results for False)
But I do not understand the data you posted.
How does fields [Total Fees] and [Mos] relate to T329 and X329?
--
Build a little, test a little.
:
thank you -- is there any chance you could show me how I would do that?
:
Heather,
The biggest thing is that the Access equivilant of the Excel "IF" function
is called "IIF". This is because in Access IF is used for scripting. IIF
(Immediate If) is used to eveluate expressions.
That might be all you need to do.
Jacob
:
Is there a way to replicate this funtionality in Access -- these are formulas
I've been using in Excel
Annnual Fees: ([Total Fees] / [Mos])*12 =IF(T329=0, "", 12*X329/T329)
Discount: ([List Price]-[Total Fees])/[List Price] =(W329-X329)/W329
Access Rate: (12* [Total Fees] / [Mos] / FRP) =IF(ISERROR(12*X2/T2/V2), "",
12*X2/T2/V2)
Thank you,
Heather