Bhavdhuti,
To me, it makes more sense to loop through the controls one time when the form initializes, and store a reference to the object with the lowest tabIndex into a custom property of the form. Then, to set focus, all you do is:
thisform.oFirstControl.setfocus()
>Here is my version. Note the STEP -1 and Conditional check in PageFrame only if there are no controls on the form.
>
< snip >
Steve Gibson