Show/Hide Toolbars

XSharp

NoteThis command is defined in a header file and will be preprocessed by the X# preprocessor to a function call. If you disable the standard header (-nostddefs) files then this command will not be available. If you tell the compiler to use a different standard header file (-stddef ) then this command may also be not available

Purpose

Add a new record to the end of the current database file and make it the current record.

Syntax

APPEND BLANK  [[IN|ALIAS] <workarea>]

 

Arguments

IN|ALIAS <workarea>Specifies the work area for which the operation must be performed

Description

The new field values are initialized to the empty values for each data type:  character fields are assigned with spaces; numeric fields are assigned 0; logical fields are assigned FALSE; date fields are assigned NULL_DATE; and memo fields are left empty.

 

For a shared database, APPEND BLANK automatically places a record lock on the new record.  If the record cannot be locked, NetErr() is set to TRUE, indicating that the record was not added, and execution continues.

 

Note: APPEND BLANK will not release any file locks set by the current process.

If NetErr() returns FALSE, the record was successfully added and locked, you can begin updating it.  The newly appended record remains locked until you explicitly release the lock (for example, with UNLOCK), close the database file, or attempt another lock.  

Examples

This example attempts to add a record to a shared database file and uses NetErr() to test if the operation succeeded:

 

USE sales SHARED NEW
<Statements>...
APPEND BLANK
IF !NetErr()
  <Update EMPTY record>...
ELSE
  ? "Append operation failed"
  BREAK
ENDIF

Assembly

XSharp.RT.DLL

See Also

APPEND FROM, DBAppend(), DBRLock(), FLock(), NetErr(), RLock()