Interpretation status check

This function steps though all fields on the form and checks if there are fields that have interpretation errors. The code below illustrates the use of the GetMaxNoOfFormFields, FormFieldExist, and GetFormFieldNo methods on the Form object.

 

Function OnFormInterpreted() As Long

 

Dim tmpStr As String

Dim tmpInt As Integer

Dim i As Integer

Dim Counter As Integer

Dim ErrorCounter As Integer

Dim CurField As Object

 

    Counter = Application.Form.GetMaxNoOfFormFields        'Get the number of fields on the form

    For i = 1 To Counter        ' Step through all found fields

        If Application.Form.FormFieldExist(i) Then

            Set CurField = Application.Form.GetFormFieldNo(i)        'Get the field with field number i

            tmpStr = CurField.GetValueStr()        'Get the field value

            tmpInt = InStr(1, tmpStr, "*")        'Does the field contain a *

            If tmpInt > 0 Then        ' If 0 then it did not contain *

                ErrorCounter = ErrorCounter + 1        ' Count the fields with stars

            End If

        End If

    Next i

 

    MsgBox "There were " & Str(ErrorCounter) & " fields with interpretation error."

 

    OnFormInterpreted = EV_OK

 

End Function

 

This could also be implemented to checking field status, CurField.GetStatus. Example: If the field contains one or more asterisks (*), then it has the status INTERPRETATION ERROR = 4. The CurField.GetStatus call then returns 4.