How do I set up mandatory form fields in Word 2003

C

chas9

I have developed a form for a number of people to use. The form includes drop
down boxes with F1 help provision. I want to have all fields completed before
someone can move onto the next one (regardless if there is a drop down box or
not - if that's possible). I understand there is the ability to use mandatory
form fields with a macro on exit if a form is not filled in. How do I do
this. I am a novice with macros therefore would appreciate a step by step
process. Thanks in anticipation.
 
J

Jay Freedman

The general method of validating the contents of a form field is shown
at http://www.word.mvps.org/FAQs/TblsFldsFms/ValidateFFields.htm. You
can copy the code from that page and make a couple of small changes to
get the behavior you want.

The example in that page is for the contrived condition that the
contents of the field must start with the letters 'KLM'. If you want
to prevent the user from exiting the field if it's empty, replace the
line

If Len(.Result) > 0 And Left$(.Result, 3) <> "KLM" Then

with the line

If Len(Trim(.Result)) = 0 Then

and change the MsgBox message appropriately.

The other change is to replace "Text2" with the actual name of the
field being validated, in two places in the code. The field's name is
the Bookmark item in the field's Properties dialog. In the code, the
name must be enclosed in double quotes.

The steps for taking a macro from a post or web page are given in
http://www.gmayor.com/installing_macro.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top