dualhcsniatpac
Board Regular
- Joined
- Feb 18, 2009
- Messages
- 126
Code:
RcTime = CInt(Right(covertime.Value, 2))
LcTime = CInt(Left(covertime.Value, 2))
If RcTime < 0 Or RcTime > 59 Or LcTime < 0 Or LcTime > 24 Or covertime.Value > 2400 Then
MsgBox "Please Enter in a Valid Time (0000-2400)", vbInformation, "Error Message"
covertime.SetFocus
Exit Sub
End If
Ok. I have a textbox where a user enters time (0000-2400). The above code will make sure that the user enters the right format.
My question is will it mess everything up if the user enters a time of 930 instead of 0930. My theory is that it will see the 2 integers as 93 and 30. If that is the case my code will reject their input and ask for another one even though it is correct.
Is there a way to detect if the integer is only 3 numbers and add a zero on. Or force the user to enter 4 numbers?
Thanks in advance.