Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
I have this piece of code that checks the appropriateness of the value entered by the user in a userform textbox. It checks on whether a time value had been entered and happens things when a non time entry is made.
This woks for the better part except for one slight annoyance. I am trying to get the cursor to show up in the textbox tb_s1_lwr. The SetFocus command doesn't appear to be doing that for me.
Code:
If IsDate(Me.tb_s1_lwr.Value) Then
' enter code here for a properly provided time
Else
MsgBox "Please enter time as h:mm using 24 hour clock.", vbExclamation, "INVALID TIME ENTRY"
'reset textbox to default
Me.tb_s1_lwr.Value = ""
tb_s1_lwr.BackColor = RGB(206, 234, 232)
tb_s1_lwr.SetFocus
mbevents = True
Exit Sub
End If
This woks for the better part except for one slight annoyance. I am trying to get the cursor to show up in the textbox tb_s1_lwr. The SetFocus command doesn't appear to be doing that for me.