On Wed, 19 Apr 2006 00:40:29 +0300, "NewUser" <ne*****@freemail.gr>
wrote:
That would not help: 0/0 still produces an error: you can't divide by
zero.
One option to deal with these problems is the iif function:
dim a as integer
dim b as integer
dim c as single
a=<somequery>
b=<anotherquery>
c=iif(b=0, 0, a/b)
By the way, there is a more common way to deal with percentages than
what you are doing. Rather than your:
c=a*100/b
write:
c=a/b
Then format the field as Percentage, and a value like 0.5 will be
displayed as 50%.
-Tom.
I try this:
A first "group" query (sorry if this isn't the right name) count the records
from a table with a criteria (field1="A") and return counter1=10 records.
A second "group" query count the records from same table with another
criteria (field1="B") and return counter2=5 records.
A form display that the "B" records are (counter2*100/counter1)=50%
The problem is when there aren't "B" records! The form display nothing!
How could I set the counter2 field to zero? So the form will display 0%?