Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing focus on Tab press, not earlier

Status
Not open for further replies.

Zebadiah

Technical User
Apr 29, 2001
22
US
I'm trying to have the user enter a value in a textbox then have the other textbox values calculate based on the new value entered in box 1.

Problem is that the value that I have to enter is a decimal value, and when I press 0 i get a division by 0 in the formulas, and if i just use "." it gives me a type mismatch. How do I get it to wait for me to finish entering my value to calculate, or do i have to use a separate button to calculate?

Any help greatly appreciated
 
I figured I had better expand more.

One of the ones i'm trying to do is a simple Fraction conversion

So textbox1 is input
Textbox2 is output

What I've been trying is to put in the
Private Sub Input_Change()

Output.Value = (1/INput.Value - 32) * 5/9

End Sub


But if You start to enter a decimal or a leading 0 in the Input textbox, it returns a div/0 or a invalid data type error.
 
why dont u use an IF condition there? if the user has typed in just 0 in the textbox, then skip executing the formula. similarly, for the decimal also.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top