• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

VALIDATING TIME FIELD WITH VALIDATION RULE

I have an ADP database that when entering a time with Short Time format as a textbox allows 00:70 and then freezes my system.  How can I trap this somehow before it locks up the system.  Maybe in the validation rule or something.
0
InvisibleMan
Asked:
InvisibleMan
  • 3
1 Solution
 
xSinbadCommented:
You could have an on change event that does a right for two characters and check to seee if they are less than 60.
0
 
xSinbadCommented:
example;

Private Sub Text0_Change()
Dim val As String, valMin As Double
val = Right(Me.Text0, 2)
valMin = CDbl(val)
If valMin > 60 Then
Me.Text0 = "00.00"
MsgBox "Problem with the minutes"
End If
End Sub
0
 
Ryan ChongCommented:
Hi,

Use IsDate Function?
0
 
xSinbadCommented:
InvisibleMan did my comment solve your problem? If it didnt then please dont accept it as an answer. I would rather not have it than have a C.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now