View Single Post
 
Old 11-29-2012, 08:10 AM
Nate Nate is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Nov 2012
Posts: 1
Nate is on a distinguished road
Default Division by Zero error

I'm running a five-slide presentation with ActiveX control buttons and text boxes.

I have a Command button on slide five that carries a value forward from TextBox3 in slide 2 to TextBox1 in Slide 5.

The operating code in Slide Five CommandButton1 is:

Me.TextBox1.Text = Slide2.TextBox3.Text
TextBox1.Text = Format(TextBox1.Text, "000.0")
TextBox2 = 2000 / TextBox1
TextBox2.Text = Format(TextBox2.Text, "0.000")

The problem is, in Slide 5, TextBox1, the value in that box is '0' until I operate the Command button - so I get a 'divide by zero' error until I put a value in Slide2.TextBox3.

Wondering if there's an if/then line I can put into CommandButton1 on slide 5 to default the value in TextBox2 on slide 5 to '0', to overcome that error?

Or would it be possible to write code in Slide2 that would carry the value of TextBox3 in Slide2 to TextBox1 in Slide5?

I have a CommandButton in Slide2 that calculates the value of Slide2.TextBox3, so maybe I can add a line that sends this value to Slide5.TextBox1?
Reply With Quote