When doing something like this with multiple fields of the same control type, it is always easier to use a control set for the fields. so all of the fields have the same name (i.e. textField1) and each has a unique index number. Then you can do
textField1(5).setfocus
or, of course you can use a variable for the index number
textField1(idxNum).setFocus