I'm currently encountering a problem. I have set up an if statement on a text box - if the number is smaller than 2.4, and larger than 6 then return an error.
However, if a user wishes to input 2.8, it will throw the error when 2 is entered, and when the '.' is entered.
Here is my code:
![]()
Private Sub txtHeight_Change() HeightNumber = CDbl(Val(Me.txtHeight.Value)) If Not Me.txtHeight = "" Then If HeightNumber >= 2.4 And HeightNumber <= 6 Then Else MsgBox ("You have entered an incorrect number. Please enter a number between 2.4m and 6m.") End If End If totcost = (HeightNumber * Width1) * (painttype + undercost) TotalCost.Value = totcost End Sub











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks