FieldName

Use this function to return the name of a field relative to another field.

Syntax

FieldName (Count, Field, Section, Form, Group)

Parameter

Description

Count

Enter positive or negative number. The system uses your entry to move beyond the field you specify. The default is zero (0).

Field

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

Section

Enter the name of a section that contains the field named. 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.

Keep in mind you can use an asterisk (*) as the object name to match parent objects. This lets you find objects without explicitly knowing the parent names.

Note For optimal performance, avoid using wildcards (*) when searching for field, section, or form names.

At first glance, FieldName may seem like an odd function. After all, one of its parameters is a field name. This function first locates the specified field. If you omit the FieldName parameter, the system uses the current field. Then the count is used to move to another field on the section.

A positive or negative number can be used for the count parameter. A positive count moves forward from the located field. A negative count moves backward from the located field. Forward and backward refer to the order that the field appears in the section's edit list, not necessarily to physical position on the section. All fields are included in the search regardless of whether they are editable or not.

If the system cannot find a field that matches the information you specified, it returns an empty string.

Example

Here are some examples: (Assume the section has three fields named First, Second, and Third, which occur in that order.)

Function

Result

Explanation

Return(FieldName (1, "Second"))

Third

Locate the field named Second and then move to the next field.

Return(FieldName (-1, "Second"))

First

Locate the field named Second and then move to the previous field.

Return(FieldName ( 8, "MyField", , "FRM"))

a name or ""

Locate the form specified within the current form group. Then locate MyField anywhere on that form. If found, move forward eight more fields. If a field matches this criteria, its name will be returned, otherwise an empty string is returned.

See also