I have an intermittant problem w/ a grid. The requirement is that if the user is on the last row of a grid (natural order only) and the user enters a value into a field (column 2) in that last row, code fires to append a blank row to the bottom and then return to the row the user was on before the append, so they can continue w/ data entry. That works fine. The issue is with the last column in the grid. The idea is to move the record pointer to the newly added last row (the blank record) as the user tabs thru the last column of the last row.
This works correctly some of the time. It works all of the time if i trace the code. But i cannot identify a pattern as to when it works and doesnt. Other than its not a problem for the first 8 or 9 records that get added. After that, its intermittant. The code is shown below. There are no deleted records involved. Anything look out of place?
IF MESSAGEBOX("Do u wanna set step on?") = 6
SET STEP ON
ENDIF
SELECT temploc
IF ! EOF()
nRec = RECNO() + 1
SKIP
IF EOF()
SKIP -1
nRec = nRec - 1
ENDIF
thisform.LockScreen = .t.
thisform.grdlocs.ActivateCell(nRec,1)
thisform.grdlocs.column1.SetFocus()
thisform.grdlocs.Refresh()
thisform.LockScreen = .f.
ENDIF