command coming up with #NUM!

mkelly

Registered User.
Local time
Yesterday, 20:02
Joined
Apr 10, 2002
Messages
213
I have a text boc on a report and the control source is:
=([text135]/[text138])

However sometimes text135 and 138 will be 0
How can I change the control to be blank in this instance instead of
"#NUM!"?

Also I set the decimal places to 2 and still get 6 or 7 decimal places is there another way to restrict that?

All help appriciated!!
 
Dont know if it will work, but try setting the default value in each of the text boxes to '0'.
 
sjdibben said:
Dont know if it will work, but try setting the default value in each of the text boxes to '0'.


there is no default setting on a text box and if there is I would still be dividing 0 by 0
 
How about using an if statement in VBA then so that if both of the text boxes are zero, don't perform the calculation and set the textbox with the calculation in to '0' ??
 
sjdibben said:
How about using an if statement in VBA then so that if both of the text boxes are zero, don't perform the calculation and set the textbox with the calculation in to '0' ??


I have been trying that

Iif(text135=0,0, text135/text138)

But keep getting an error on the opening of the report, I guess I am not that good at VBA
 
sjdibben said:
How about using an if statement in VBA then so that if both of the text boxes are zero, don't perform the calculation and set the textbox with the calculation in to '0' ??


Also tried

(IIf([text135]=0,0,[text135]/[text138]))
 
thanks finally got it...

=IIF([text132]=0,"0",[text132]/[text143])
 

Users who are viewing this thread

Back
Top Bottom