Form Field Required

P

PMBO

I have the macro shown below attached to the ENTRY of a text form field. it
does what I want it to do, except if the user clicks OK on the message box
and doesn't fill in the field then presses the TAB key, they just move onto
the next field. How can I make it stay on the field until they fill it in?

Thanks,

Sub Premium1()
'
' Fillin Macro
' Macro recorded 4/17/2008 by Paula
'
If ActiveDocument.FormFields("Premium").Result = "" Then
MsgBox "You must fill in PREMIUM field"
Selection.GoTo What:=wdGoToBookmark, Name:="Premium"
End If
End Sub
 
J

Jean-Guy Marcil

PMBO said:
I have the macro shown below attached to the ENTRY of a text form field. it
does what I want it to do, except if the user clicks OK on the message box
and doesn't fill in the field then presses the TAB key, they just move onto
the next field. How can I make it stay on the field until they fill it in?

Does the field following the PREMIUM one have the same OnEntry macro?
 
P

PMBO

No. The next form field is not a required field. This particular form has
many fields on it, and only a few are required.

Thanks for your help.
 
J

Jean-Guy Marcil

PMBO said:
No. The next form field is not a required field. This particular form has
many fields on it, and only a few are required.

The code you posted should not be used with required formfields, but OnEntry
of non-required ones to check if the required ones were filled out properly.

The main reason is that you cannot stop Word from going to the next
formfield, even through the use of a maro in the OnExit "event".

Actually, there is a workaround that can get quickly complicated if you have
many required formfields.
For a discussion see the second post on this page:

http://groups.google.com/group/micr...576f59bbaece?hl=en&lnk=st&q=#107f576f59bbaece

Performing formfield validation can get real hairy real fast, depending on
the complexity of the form.

See the thread "Form Text Field Check" (The third one before the one you
started today).
 

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