Hi Mike,
Thank for visiting my country. I would like you to revisit again. Lots of changes.
Try putting
NODEFAULT after THISFORM.GRDHILIT1.COLTEACHER.TEXT1.SETFOCUS()
>Hi Manoj:
>
>We visited your great country in 1985 and we will never forget it!
>
>I have tried your code as below.
>
>IF NKEYCODE = 13 && enter
> SET EXACT OFF
> LOCATE FOR UPPER(TEACHER) = UPPER(TRIM(MEM1))
> IF FOUND()
> THISFORM.GRDHILIT1.COLTEACHER.TEXT1.SETFOCUS()
> ELSE
> LOCATE FOR UPPER(TRIM(MEM1)) $ UPPER(TEACHER)
> IF FOUND()
> THISFORM.GRDHILIT1.COLTEACHER.TEXT1.SETFOCUS()
> ELSE
> WAIT WINDOW "Name not found"
> GO TOP
> THISFORM.GRDHILIT1.COLTEACHER.TEXT1.SETFOCUS()
> ENDIF
> ENDIF
>ENDIF
>
>In this case the name of the column is COLTEACHER and the name of the field is TEXT1.
>
>This makes to difference.
>
>I still get just a momentary focus on the grid and it returns back to the pattern box.
>
>Mike Smith