Hello All,
Thought I would ask for your expertise on this question as you all have been so helpful with other ones.
Trying to have a format validation for a Registration Date Textbox
What I am trying to do is have the cursor return to the textbox (similar to "stop" error alert when adding data validation to a cell)
I've tried Textbox1.SetFocus
and TextBox1.Activate
and TextBox1.Select
None of these work, please advise as a person could click "okay" on the msg box and proceed, leaving the date box blank.
Here is my code as it stands
Private Sub RegTime_LostFocus()
If RegTime.Value = NumericFormat Then
If RegTime.Value = Format(RegTime.Text, "h:mm;@") Or RegTime.Value = Format(RegTime.Text, "[$-409]h:mm AM/PM;@") Then
RegTime.Value = Format(RegTime.Text, "[$-409]h:mm AM/PM;@")
Else
MsgBox "Please enter time in a 24hour hh:mm format"
RegTime.Value = ""
RegTime.Activate
End If
Else
MsgBox "Please enter time in a numeric fashion"
RegTime.Value = ""
RegTime.Activate
End If
End Sub
Bookmarks