I have a user form that is having an issue with the set focus. Here is some of the code that I am using.
The issue that I am having is that when I hit the enter key after typing in a Partnumber the focus always goes to the next textbox. Even though I end the code by using the partnumber.setfocus command. In all of the deleted code I never set the focus elsewhere so I am confused as to why this is happening. Thank you for your help.
Code:
Private Sub PartNumber_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If Me.done.Value <> True Then
If KeyCode = vbKeyReturn Then
' whole bunch of code deleted from here
end if
end if
Me.PartNumber.SetFocus
End Sub
Private Sub PartNumber_Change()
' Even more code deleted from here
Me.PartNumber.SetFocus
End Sub
The issue that I am having is that when I hit the enter key after typing in a Partnumber the focus always goes to the next textbox. Even though I end the code by using the partnumber.setfocus command. In all of the deleted code I never set the focus elsewhere so I am confused as to why this is happening. Thank you for your help.