Private Sub txtHours_BeforeUpdate(Cancel As Integer)
Dim MyArray As Variant
'-- Test for clearing this TextBox
If Not IsNumeric(Me.txtHours) Then
Me.Undo
Cancel = True
Else
If Me.txtHours <> Int(Me.txtHours) Then
'-- There is a fractional component. Make sure it is divisible by .25
MyArray = Split(CStr((Me.txtHours)), ".")
If Len(MyArray(1)) = 1 Then
MyArray(1) = MyArray(1) & "0" '-- Pad out to 2 places
ElseIf Len(MyArray(1)) > 2 Then
MyArray(1) = Left(MyArray(1), 2) '-- Truncate to 2 places
End If
If Val(MyArray(1)) Mod 25 Then
MsgBox "Entry must be in 1/4 hour increments!"
Cancel = True
End If
End If
End If
End Sub