Calculated Fields

G

Guest

Hi

I hope that someone can help?

I have a report with a simple field with the following control source.

=[text193]/[Text207]

however the text boxes are summing the data from a table and this works fine

the code being

=DSum("Jun05","Report 2 Matrix","[subsection]='LRRevenues' and
[Type]='ISDN30Installations Channels'")

The problem I have is that I get an error #Num! when dividing Zero by Zero.

The fields being looked up are Numeric with field size "Double" "fixed" to
0 decimal
Places.

The actual that I need to return is of course Zero

Please accept my thanks for your assistance

Rgds

Colin
 
G

Guest

=[text193]/Iif([Text207]=0,1,[Text207])
This will prevent the divide by zero error. If [Text207] is 0 then the
value in [text193] will be returned.

Computers since the beginning of time have never been able to divide by 0.
It is a mathmatical impossibility. It is always a good idea to test for 0 in
the divisor before doing a divide. Changing it to 1 is the classical way to
do it. Of course, if the variable or field that is zero and should not be,
then you need to do some sort of error handling.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top