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

IIF function 1

Status
Not open for further replies.

eshaan

Technical User
Feb 20, 2003
57
US
I have Access 97 report. On text field it is calculating
from three fields sum numbers like 20/10+7 = 17 and converting into percentage because I set property format as percent.

If there is 0 it is 0/0 = 0% but instead of that it is giving error #Num! It is not printing 0%

If I want to write code in expression builder
If xfield = 0 then
? "None"
Else
= ([sumy]/[sumofy]+sumofN)
Endif

How can I write in Expression builder above code.I wrote in IIF function some have it is not working.

Please urgent.
 
How are ya eshaan . . . . .

Your getting the equivalent of an [blue]Divide By Zero Error[/blue]. So according to descriptors in you formula:

Code:
[blue]IIf([sumofy]=0, 0, ([sumy]/[sumofy]+sumofN))[/blue]


Calvin.gif
See Ya! . . . . . .
 
What I did wrong? Please help me.

IIF([SumOfYesScore]=0,0,([sumofyesscores]/[SumOfYesScore]+SumOfNoScore))

Giving error Syntax error (comma) in query expression
 
eshaan . . . . .

Can [blue]SumOfYesScore[/blue] be [purple]Null[/purple]?

Try brackets where you see them below.
[purple][[/purple]SumOfNoScore[purple]][/purple]

If that does'nt work, post the query . . . .

Calvin.gif
See Ya! . . . . . .
 
eshaan said:
20/10+7 = 17
Is there something missing here?

Good Luck
--------------
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
How are ya CajunCenturion . . . . .

I took it as some kind of typo glitch! ;-) Don't wanna believe the general math is . . . . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top