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

IF !EOF()
  *-- 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

  *-- If we're at EOF, return EOF code
  IF EOF()
    SKIP -1
    RETURN FILE_EOF
  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_EOF
ENDIF