I have a userform that has a number of textboxes.
Some of the textboxes require a numeric value to be entered and I perform a check on the entry with the _afterupdate event.
If the textbox entry isn't numeric, a message box pops up, the textbox is cleared and I want that textbox to hold the focus as it needs an entry. I have the textbox.SetFocus in the _afterupdate code but as I am using TabStop values for if the user uses the TAB key to navigate through the form, the .SetFocus is being ignored.
Some of the textboxes require a numeric value to be entered and I perform a check on the entry with the _afterupdate event.
If the textbox entry isn't numeric, a message box pops up, the textbox is cleared and I want that textbox to hold the focus as it needs an entry. I have the textbox.SetFocus in the _afterupdate code but as I am using TabStop values for if the user uses the TAB key to navigate through the form, the .SetFocus is being ignored.
VBA Code:
Private Sub txtLoanCount_afterupdate()
If IsNumeric(txtLoanCount) = False Then
MsgBox ("Enter a numeric value of 1 to 5 only"), vbExclamation, "ERROR"
txtLoanCount = ""
txtLoanCount.SetFocus
Exit Sub
Else
End If
strControl = mpCaseDetails(mpCaseDetails.Value).ActiveControl.Name
CheckForm
End Sub