last Method
Class: tsbaseform
Expand/Collapse source code of procedure last Source Code
*-- Last
LOCAL lnRecNo, ;
      lnRetVal, ;
      llNewAndEmpty

*-- If the contents of the current control could not 
*-- be saved, return cancel code
IF !thisform.WriteBuffer()
  RETURN FILE_CANCEL
ENDIF

*-- If adding a new record but nothing entered yet
IF thisform.IsNewAndEmpty()
  thisform.Restore()
  llNewAndEmpty = .T.
ELSE
  *-- If data changed and user cancels, return cancel code
  IF thisform.DataChanged() AND thisform.AskToSave() = IDCANCEL
    RETURN FILE_CANCEL
  ENDIF
ENDIF
lnRecNo = RECNO()
GO BOTTOM

*-- If we're still on the same record,
*-- return cancel code
IF !llNewAndEmpty AND lnRecNo = RECNO()
  RETURN FILE_CANCEL
ENDIF

IF !EOF()
  thisform.RefreshForm()
ENDIF

RETURN FILE_EOF