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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling Decimal Places

Status
Not open for further replies.

Tarbuza

Technical User
Dec 13, 2000
56
US
I want to prompt an invalid number onBlur of my Amount field if the user types in 500.438 (valid number is 500.43). I don't want to chop myself but prompt the user that it is invalid to type more than two decimal places.

Any help would be greatly appreciated. Thanks.
 
Hi!

If you want to force the user to put in only two decimals you can use the following code in the before update event procedure of the text box:

If CDbl(YourText.Text)*100 Mod 10 <> 0 Then
Call MsgBox(&quot;You may only enter two demicals&quot;)
Cancel = -1
End If

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top