I,m trying to check the result of a field that I am tabbing out of to see if the user entered anything. If the field is blank, I am skipping to the next section of the report rather than requiring the user to tab through unneeded fields.
I am using the procedure below to get the name of the field stored in a public variable so I can use the field name in the OnExit routine to check for an entry. This works fine when the document is unprotected, but when it is protected I get "Runtime error 5941 - The requested member of the collection does not exist." Is there a way to check a field name without unlocking the form first.
Public FNm As String
' This is an OnEntry routine
Sub GetFieldName()
FNm = Selection.FormFields(1).Name
End Sub
'This is an OnExit routine. I tried doing all this in one
' routine but it didn't work.
Sub SkipExamFields()
If ActiveDocument.FormFields(FNm).Result = "" Then
ActiveDocument.FormFields("CkPEYes".Select
End If
End Sub
I am using the procedure below to get the name of the field stored in a public variable so I can use the field name in the OnExit routine to check for an entry. This works fine when the document is unprotected, but when it is protected I get "Runtime error 5941 - The requested member of the collection does not exist." Is there a way to check a field name without unlocking the form first.
Public FNm As String
' This is an OnEntry routine
Sub GetFieldName()
FNm = Selection.FormFields(1).Name
End Sub
'This is an OnExit routine. I tried doing all this in one
' routine but it didn't work.
Sub SkipExamFields()
If ActiveDocument.FormFields(FNm).Result = "" Then
ActiveDocument.FormFields("CkPEYes".Select
End If
End Sub