SetProtect

Use this procedure/function to protect a specified field so it cannot be altered or to unprotect a field so that it can be edited.

Syntax

SetProtect (Mode, Field, Section, Form, Group)

Parameter

Description

Mode

Enter a non-zero value to specify field protection mode. Enter zero (0) to leave the field unprotected. The default is one (1), which protects the field.

Field

Enter the name of the field. The default is the current field.

Section

Enter the name of a section that contains the field you specified. The default is the current section.

Form

Enter the name of a form that contains the section and/or field named. The default is the current form.

Group

Enter the name of the form group that contains the form, section, and/or field named. The default is the current group.

The system returns zero (0) if the field you specified could not be changed or does not exist in the section. The system returns one (1) if the field was successfully protected.

Example

Here are some examples:

(Assume the section has fields named First and Second. Assume First contains Y.)

Procedure

Result

Explanation

IF (@( ) ="Y")

SetProtect(

1, "SECOND");

END

1

Tests the value of the current field (First). Since it contains the letter Y, Second is protected. If you call SetProtect as a procedure, a one (1) is returned, indicating the field was successfully protected.

IF (@( ) ="Y")

SetProtect

(0, "SECOND");

END

1

Unprotects Second based on the same criteria.

See also