LOCAL lnRecNo, ;
llRetVal
llRetVal = .T.
IF MESSAGEBOX(DELETEREC_LOC, ;
MB_ICONQUESTION + MB_YESNO, ;
DELETEWARN_LOC) = IDNO
RETURN .F.
ENDIF
*-- If adding a new record, just revert it
IF "3" $ GETFLDSTATE(-1) OR "4" $ GETFLDSTATE(-1)
thisform.Restore()
RETURN .T.
ENDIF
lnRecNo = RECNO()
DELETE
*-- When buffering is in use, you need to move off the record to
*-- actually delete it. This may not be successful if the
*-- delete trigger fails.
SKIP
IF EOF()
SKIP -1
IF !BOF()
thisform.RefreshForm()
ELSE
*-- Ask to add a new record if user just deleted last record
*-- in file
IF (MESSAGEBOX(ADDNEWREC_LOC, ;
MB_ICONQUESTION + MB_YESNO, ;
TASTRADE_LOC)) = IDYES
thisform.AddNew()
ELSE
*-- If user does not wish to add a new record, no sense keeping
*-- the form around.
thisform.Release()
ENDIF
ENDIF
ELSE
IF lnRecNo = RECNO()
llRetVal = .F.
ELSE
thisform.RefreshForm()
ENDIF
ENDIF
RETURN llRetVal