G
Guest
I have a form with a combo box containing numbers up to 9 in .25 increments.
I'd like to display a message box if the user tries to manually enter
something greater than 9. Then I'd like to set the focus on the combo box.
The message box code works, but the set focus code does not. I've tried the
code in the afterupdate and onexit subs. The code is below. What am I doing
wrong?
Private Sub Hours_AfterUpdate()
If Hours.Value > 9 Then
MsgBox ("Please select an option from the drop-down menu." _
& vbCrLf & "If an option is not available, ask yourself why you
work so much.")
Me.Controls(Hours).SetFocus
End If
End Sub
I'd like to display a message box if the user tries to manually enter
something greater than 9. Then I'd like to set the focus on the combo box.
The message box code works, but the set focus code does not. I've tried the
code in the afterupdate and onexit subs. The code is below. What am I doing
wrong?
Private Sub Hours_AfterUpdate()
If Hours.Value > 9 Then
MsgBox ("Please select an option from the drop-down menu." _
& vbCrLf & "If an option is not available, ask yourself why you
work so much.")
Me.Controls(Hours).SetFocus
End If
End Sub