>>>Hi,
>>>
>>>When press the commandbutton (represents enter key) is pressed, the focus will shift from textbox2 to textbox3. Thanks
>>
>>How about this......(completely untested)
>>
>>Create a Form Property named (something like) LastTextBox.
>>In the Valid of each textbox put
thisform.LastTextBox = this
>>In the click event of the command button put
thisform.LastTextBox.setFocus
>>KEYBOARD {ENTER}
>>
>
>I would not save any form's object reference in a property of that form.
>Think that form would not close any more
I did a quick test (six textboxes and one command button with no underlying logic) and the form closed ok. I suppose you could also put a "thisform.LastExtBox = .NULL." somewhere in the Release or Destroy or some other method.
Actually, I think my second method (although slightly more difficult to maintain) works much better. The first one has problems when you get past the last textbox and/or have other controls you don't want to reach via the command button.