>Hi all,
>
>Reviewing another application that is giving me heartburn. There is a trick I learned a while back that I would like to share and why it's important.
>
>When data on a form is being edited, it's a good idea to SetFocus to the first control. This may seem like a nobrainer, but if you don't do it and the user hits "Add" or "Modify" then the focus never leaves that commandbutton.
>
>A really easy way to do it is to add a custom property to your form class such as "FirstEditControl" and default it to blank. In the instances of the form class, you can fill it in with "ThisForm.txtFirstName" or whatever and then put the following code in the Add or Modify method as the last thing to do:
>IF !EMPTY(ThisForm.FirstEditControl)
> cEditControl=ThisForm.FirstEditControl
> &cEditControl..SetFocus()
> &cEditControl..Refresh()
>ENDIF
For the macroexansion-phobic like me:
oEditControl = EVAL('thisform.'+thisform.FirstEditControl)
oEditControl.SetFocus()
oEditControl.Refresh()