Time Format Check (In Textbox)

This code checks that a valid time has been entered into a text box. The check is in HH:MM format.

Private Sub txtTme_Exit(ByVal Cancel As MSForms.ReturnBoolean) 'Check to ensure only a time is entered into the system and formats it correctly before sending it to db With txtTme If IsDate(.Text) Then 'Format Time .Text = Format$(.Text, "HH:MM") ElseIf txtTme = "" Then MsgBox ("Please enter a time in format HH:MM") Else 'Error & Clear MsgBox ("You have not entered a valid time. Please enter in format HH:MM") Cancel = True End If End With End Sub

Code Snippits