Share via


SetField Method

The SetField method sets the value of the specified field.

Syntax

object.SetField

(

i_FieldName As String,

i_FieldValue As Variant

)

Parameters

Parameter Description

i_FieldName

Name of the field to set.

i_FieldValue

Value for the field.

Remarks

Typically, you use SetField to update a field in a record when the record is not currently being edited by the user, such as when you are running a macro or when updating a field of the parent record of the record currently being edited.

In most cases if a form is being edited, you should update the form fields rather than the fields in the underlying record. You can update a form field using one of the Public Script FunctionsSetHTMLFieldValueAsNumber, SetHTMLFieldValueAsDate, SetHTMLFieldValue, or SetContactFieldValue.

Note

If you update the underlying record while the form is being edited, the form will not be refreshed with the updated values and, if the user or a script saves the form, the updated values in the record will be overwritten by the older values in the form.

Note

There is one exception where you should use SetField on a form being edited. In an OnAfterSubmitData function, you should update fields in the record with SetField rather than by updating the HTML field on the form. Since the navigation leaves the form after this function completes, any data written to the form's HTML fields would be lost.

See Also

Reference

IGrooveFormsToolRecord Interface
HasField Method
OpenField Method

Concepts

Accessing Forms Records