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

IF !BOF()
  *-- 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()
  SKIP -1

  *-- If we're at BOF, return BOF code
  IF BOF()
    RETURN FILE_BOF
  ENDIF

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

  *-- If we get this far, all is well
  thisform.RefreshForm()
   RETURN FILE_OK
ELSE
  RETURN FILE_BOF
ENDIF