Equinox Online Help - Language Reference - A to Z

Home

InsertRecord

Applies to
SyntaxInsertRecord [SwitchExpression]
Action[Statement] Inserts a new record into the database.
ScopeOnly usable in subtables.
Notes

This statement inserts a new record into the current database. The optional argument, SwitchExpression, determines the field values of the new record.

If SwitchExpression evaluates as True, then the new record is a duplicate of the last selected record. If the argument is False, or omitted, then the new record's fields are initially blank, unless they have been assigned in the method (before the InsertRecord statement).

If an error occurs, an error number is stored in the system workarea SysError.

The inserted record becomes the current record if the statement completes successfully.

CategoryRecord editing
See Also BlankRecord, DeleteRecord, FieldChanged, IsField, ReplaceRecord
Example

This method inserts a record into the grade table, for the current employee. Note that the field values are set before the InsertRecord statement is used (GradeNow is a field in the employee table, outside the block).

subtable grade
BlankRecord
OldGrade = NoGrade
NewGrade = GradeNow
GradeDate = Today
InsertRecord

if syserror then
ReportError 490, "Inserting in grade table, 4
end if
end subtable | grade