... If oCtl.TabIndex < lnIndex IF PemStatus(oCtl,"SEtfocus",5) lnIndex = oCtl.TabIndex This.FirstControl = oCtl.Name ENDIF Endif ...Don't forget to check if the found control has a SetFocus method. Also the code didn't deal with the only control in the fomr being a pageframe or grid, whereon you would need to drill into those objects to find the "first" control.