IF nKeyCode = 13 blah blah blah NODEFAULT ENDIFIf you don't execute NODEFAULT then the chr(13) will be processed by the control that is was typed in and that control's Valid and LostFocus will fire and VFP will move focus to the next control in the tab order. All of this will happen AFTER you setfocus to the textbox. So, even though it looks like your setfocus isn't working, it is working fine, but focus is being moved again after the textbox got focus.