DeleteRecord (delete a record)

Top  Previous  Next


DeleteRecord (< query >),PROC,VIRTUAL


Deletes a record from a file.


A numeric constant, variable, EQUATE, or expression that determines whether DeleteRecord offers to confirm the delete with the end user. A value of one (1 or True) deletes only on confirmation from the end user; a value of zero (0 or False) delete without confirmation. If omitted, query defaults to 1.

The DeleteRecord method deletes a record from the file and returns Level:Benign (declared in ABERROR.INC). The primary purpose of this method is to permit the redefinition of "Delete" where appropriate. Possible uses include flagging a record as opposed to physically deleting it or logging delete transactions as they occur. The Query parameter is provided for compatibility with the Relation Manager's Delete method. RelationManager.Delete calls FileManager.DeleteRecord with Query = 1 in all cases except that where a delete has been requested without notifying the user. This allows derived versions of FileManager.DeleteRecord to physically delete a record after, say, the cancellation of autoincremented update.

The standard DeleteRecord method physically deletes the record and always returns Level:Benign (0).

Return Data Type:     BYTE





INCLUDE('ABFILE.INC')              !declare FileManager class

MAP .                             !program map

GlobalErrors ErrorClass            !declare GlobalErrors object

Access:Client CLASS(FileManager)   !derive Access:Client object


InsertWindow WINDOW('Add a new Client'),AT(,,159,73),IMM,SYSTEM,GRAY


             ENTRY(@s20),AT(61,20,84,10),USE(CLI:Name),MSG('Client Name'),REQ

             PROMPT('State Code:'),AT(8,34),USE(?CLI:StateCode:Prompt)

             ENTRY(@s2),AT(61,34,40,10),USE(CLI:StateCode),MSG('State Code')




!program code




  IF EVENT() = Event:Accepted                     !on OK button

   IF Access:Client.DeleteRecord() = Level:Benign !delete the new Client record

    POST(Event:CloseWindow)                       !if delete succeeds, close down

   ELSE                                           !if delete fails

    Access:Client.CancelAutoInc                   !restore the file

    CYCLE                                         !and start over



!more code

See Also:     Deleted