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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word form fields. . . how to make required

Status
Not open for further replies.

Storyteller

Instructor
Apr 19, 1999
343
0
0
CA
Hello All,
I was wondering if it is possible to make a Word form field "Text, Checkbox or Drop-down" a required field.

I have looked at the "Form Field Options" for each and I can specify "Default values", "Text/Number format", "Drop-down items", however I have not seen a means of making a field "Required"

I have thought of making an "Exit Macro" to make the field required, but in looking through the VBE "Object Browser" I cannot find anything to make a form field required.

As I'm typing this I'm thinking perhaps code to check length of data in the field and if it is not >0 then a message box appears to say that the field is required. Any comments? Other ideas?

Thanks,
Michael
 
Michael,

There's probably a more elegant way to do this, but what we did was create fillin fields, prompting for the required information.

SA
 
I agree code in an exit macro like;
if len(field1) = 0 then
' set the focus back to the form field and display msgbox
end if
should work nicely
 
Hello All,
Thanks for your quick responses. I've tried the following code:

Sub services()
If ActiveDocument.Bookmarks(20) = "**REQUIRED" Then
' "20" is the "services" bookmark index number
MsgBox "This is a required field", vbExclamation, "Services"
End If
End Sub

I've added this as the exit macro for the field that has been bookmarked as "services" the default value is **REQUIRED** The good news is that I didn't get any error messages (after 5+ tries), but the bad news is that when I tab out of the field the message box does not appear.

What am I missing?

Thanks,
Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top