>local loMinControl >loMinControl = .null. >for each loControl in ThisForm.Controls > if isnull(loMinControl) > if upper(loControl.BaseClass) <> "GRID" and pemstatus(loControl, 'SetFocus', 5) and loControl.Enabled > loMinControl = loControl > endif > loop > endif > if upper(loControl.BaseClass) <> "GRID" and pemstatus(loControl, 'SetFocus', 5) and loControl.Enabled > if loControl.TabIndex < loMinControl.TabIndex > loMinControl = loControl > endif > endif >endfor >if not isnull(loMinControl) > loMinControl.SetFocus() >endif >That works.