In a form, how do I make a field mandatory b/4 proceeding to next

J

Jay Freedman

See http://word.mvps.org/FAQs/TblsFldsFms/ValidateFFields.htm for the
general idea.

To make sure the user can't exit a field without entering something in it,
use the code in the article but change the line


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


to


If Len(.Result) = 0 Then


You'll also have to change the field name ("Test2" in the example) to the
correct name wherever it appears in the macro, and change the message that's
displayed by the MsgBox statement.


Each mandatory field needs its own exit macro because the field's name is
explicitly written into the code. If you have a lot of mandatory fields, it
may be possible to revise the code so the same macro functions for all of
them.

--
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