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

*-- 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()
ELSE
  *-- If data changed and user cancels, return cancel code
  IF thisform.DataChanged() AND thisform.AskToSave() = IDCANCEL
    RETURN FILE_CANCEL
  ENDIF
ENDIF
lnRecNo = RECNO()
LOCATE

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

IF EOF()
  RETURN FILE_EOF
ENDIF

thisform.RefreshForm()
RETURN FILE_BOF