BLANK Command

Clears data from the specified fields in the current record or from all fields in the current record when issued without additional arguments.

BLANK [FIELDS FieldList] [DEFAULT [AUTOINC]] [Scope] [FOR lExpression1] 
   [WHILE lExpression2] [NOOPTIMIZE] [IN nWorkArea | cTableAlias]


[FIELDS FieldList]

Clears only the fields you specify with FieldList. If you omit the FIELDS clause, all fields in a record are cleared by default. Any field you specify in an unselected work area must be prefaced with the alias of the work area.


BLANK does not clear field data of a record in another related work area if the record pointer is at the end of the file in the current work area. The record pointer must be on a record in the current work area in order for BLANK to act on the fields in the related record.


Initializes specified fields to their default values as specified with the DEFAULT clause for tables that belong to a database and cursors. If no fields are specified, the default values of all fields in the current record are initialized. DEFAULT does not apply to free tables.

The AUTOINC keyword specifies to include all automatically incrementing fields. If you omit AUTOINC, the automatically incrementing fields are left intact with their original values.


Performing updates to automatically incrementing fields requires locking the table header. If you call the BLANK command with the DEFAULT AUTOINC clause with the table file opened in shared mode, is unlocked, and the SET MULTILOCKS command is set to OFF, Visual FoxPro generates an error.


Specifies a range of records to clear. The default scope for BLANK is the current record (NEXT 1). Only the records that fall within the range are cleared.

The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST.

Commands that include the Scope parameter operate only on the table in the active work area.

For more information on scope clauses, see Scope Clauses.

FOR lExpression1

Clears field data in records for which lExpression1 evaluates to True (.T.). Rushmore Query Optimization optimizes BLANK FOR if lExpression1 is an optimizable expression. A discussion of Rushmore Query Optimization appears in Using Rushmore Query Optimization to Speed Data Access.

WHILE lExpression2

Specifies a condition whereby field data in records is cleared as long as the logical expression lExpression2 evaluates to True (.T.).


Prevents Rushmore optimization of BLANK. For more information see SET OPTIMIZE Command and Using Rushmore Query Optimization to Speed Data Access.

IN nWorkArea| cTableAlias

Specifies the work area or table alias affected by the BLANK command. Use this clause to specify a work area or a table outside the current work area.

Expand imageRemarks

Expand imageExample

Expand imageSee Also

© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic