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. IF NOT EOF() 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 ELSE && EOF SKIP -1 THISFORM.RefreshForm() ENDIF RETURN m.llRetVal