LOCAL lnLoop, lnClass,lnLoopPages, lnPagesControls, lcPageControlClass, lnPages WITH THISFORM FOR lnLoop = 1 TO .CONTROLCOUNT lcClass = UPPER(.CONTROLS[lnLoop].BASECLASS) IF lcClass = "TEXTBOX" THEN .CONTROLS[lnLoop].SETFOCUS ENDIF IF lcClass ="PAGEFRAME" THEN lnPages = .CONTROLS[lnLoop].PAGECOUNT FOR lnLoopPages = 1 TO lnPages FOR lnPagesControls = 1 TO .CONTROLS[lnLoop].PAGES[lnLoopPages].CONTROLCOUNT lcPageControlClass = UPPER(.CONTROLS[lnLoop].PAGES[lnLoopPages].CONTROLS[lnPagesControls].BASECLASS) IF lcPageControlClass == "TEXTBOX" .CONTROLS[lnLoop].PAGES[lnLoopPages].CONTROLS[lnPagesControls].SETFOCUS() ENDIF ENDFOR ENDFOR ENDIF ENDFOR ENDWITHbut you would still probably need to set some property on the first control so that you have some way of identifying it in the controls collection.