calculation in a text box

  • Thread starter Thread starter Ray
  • Start date Start date
R

Ray

i need to subtract text box 1 from text box 2 and if text
box 1 is larger than text box 2 it should equal zero
 
Try this in the change event for textbox

If textbox1>textbox2 the
textbox1=
elseif textbox1<=textbox2 the
textbox1=textbox2-textbox
end i

hope it help
Rocco
 
This is for code w/ in a textbox (or other control):

=iif(TextBox1 > TextBox2, 0, TextBox2 - TextBox1)
(This should go in the .ControlSource field)

Or just a standard If..ElseIf..EndIf

If TextBox1 > TextBox2
intResult = 0
Else
intResult = TextBox2 - TextBox1
End If

Eric Dreksler
 
=iif([Text1]>[Text2],0,[Text2]-[Text1])

I'm assuming your text boxes are formatted as numbers.


Rick
i need to subtract text box 1 from text box 2 and if text
box 1 is larger than text box 2 it should equal zero
 
Back
Top