Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Current FormField Name While Protected For Forms

Status
Not open for further replies.

ACH381

Technical User
Apr 3, 2002
49
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top