Werner, if you SET CONFIRM ON in the GotFocus() of the last control and SET CONFIRM OFF in the LostFocus() you will not have this trouble. SET CONFIRM ON forces the user to hit TAB or ENTER to leave the control.
HTH
Barbara
>In an earlier message (thread #
139555) Edward Pikman suggested I could keep the focus within the current form of a formset by trapping for TAB, Enter, arrows, etc. in the keypress events of the first and last controls.
>
>While this works fine for most situations, I can't figure out how to influence the focus when the last control in the tab order is a text or edit box and the user fills up the preset length.
>
>This is what I've tried in the text box InteractiveChange event:
>
>IF LEN(TRIM(THIS.Value)) = 5 && the InputMask property is XXXXX
>THISFORM.cbNext.SetFocus
>ENDIF
>
>but it doesn't work.
>
>Any ideas ?