calculation in a text box

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
 
R

rocco

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
 
E

Eric Dreksler

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
 
R

Rick

=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
 

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