table.ENTER_END Function

Syntax

<TBL>.ENTER_END([Commit_Flag as L [, Update_UI as L]])

Arguments

Commit_FlagLogical

Default = .T.. If .T., the values in the record buffer are written to the table. If .F., the new record is not created.

Update_UILogical

Default = .F.. If .T., sends a notification that the table has changed. Any existing Forms or Browses will receive this notification and update their interface if they reference the table.

Description

Completes the creation of a new table record.

The <TBL>.ENTER_END()completes the creation of a new table record, saving the contents of the current record buffer. The <TBL>.ENTER_END() method must follow a corresponding <TBL>.ENTER_BEGIN()using the same pointer (<TBL>).

Bad field values (i.e., that violate field rules or the field data type) will be found by Alpha Anywhere at the time the field value is assigned. This will cause a run-time error that you should intercept with an error handling routine.

Any run-time error that occurs between an <TBL>.ENTER_BEGIN() and its corresponding <TBL>.ENTER_END() will stop script execution and leave you in Enter mode. To avoid this, use an ON ERROR GOTO statement before the <TBL>.ENTER_BEGIN() to set up an error handler for the Enter operation.

Example 

Enter a new record, assigning a default value to the COUNTRY field. If an error occurs the Commit_Flag will be set to FALSE (.F.). and the new record will be aborted.

dim tbl as P
tbl = table.current()
if (tbl.mode_get()> 0) then
    ui_msg_box("Warning", "Already in data entry mode.",
    UI_ATTENTION_SYMBOL)
else
    commit_flag = .T.
    tbl.enter_begin()
    ON ERROR GOTO error_handler
    tbl.country = "South Africa"
    tbl.enter_end(commit_flag)
end if
end
error_handler:
    commit_flag = .F.
resume next

See Also