*** Check to see if F5 was pressed IF nKeyCode = -4 WITH This.Parent.Parent *** Set Focus elsewhere to avoid Record in use by another error *** when we set focus to the first column of the newly appended record *** Also, if we do NOT set focus elsewhere, even though the AddNewRecord() method *** Does indeed add a new record, the newly appended record appears as the first *** line in the grid and the cursor moves to column 1 in the last row of the grid .lAdding = .T. .Parent.SetFocus() .AddNewRecord() .lAdding = .F. NODEFAULT ENDWITH ENDIFCode like this in the grid's AddNewRecord method:
LOCAL lcOrder, loColumn WITH This *** First check to see if we have an index order set on the table *** because we want add the new record to the bottom of the grid *** and not in index order lcOrder = ORDER( .RecordSource ) Thisform.LockScreen = .T. SELECT ( .RecordSource ) SET ORDER TO APPEND BLANK IN ( .RecordSource ) *** Find out which column is the first column FOR EACH loColumn IN .Columns IF loColumn.ColumnOrder = 1 loColumn.SetFocus() EXIT ENDIF ENDFOR *** Reset the previous order IF ! EMPTY( lcOrder ) SET ORDER TO ( lcOrder ) IN ( .RecordSource ) ENDIF .RefreshControls() ThisForm.LockScreen = .F. ENDWITHI have no enough konledge to check out the bug is surely about the allowAddNew property of grid object or not. Maybe here someone else could make it out. I hope my solution also helpful to you. Also I will thanks all the persons here have given the help to me.