View Single Post
  #2   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default How do I make fields grey out automatically when irrelevant?

As an example. Let's say that you have a checkbox field 'check1' which is
checked for full time work
and that you have a text form field 'Text1' which collects the hours worked.
If you run the following macro on exit from the Text1 field, if anything is
entered in that field, when Check1 is checked the content is removed from
Text 1 and a warning message popped up, before moving on to the next field.

Sub AOnExit()
If ActiveDocument.FormFields("Check1").CheckBox.Value = True Then
If Len(ActiveDocument.FormFields("Text1").Result) 0 Then
'*******
ActiveDocument.FormFields("Text1").Result = ""
'*******
MsgBox "Full time worker. This box is not applicable"
End If
End If
End Sub

http://www.gmayor.com/installing_macro.htm

There are some useful pages on Greg Maxey's web site about forms, start with
http://gregmaxey.mvps.org/Form_Fields_Master.htm


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Donna wrote:
I am trying to make a request form on which I want to force the user
to complete all applicable fields. Can I format the request form so
that dependant on the users answers only the applicable fields are
show? Example:
Question: Are you: full time or part time?
Question: How many hours do you work?

The second question is not applicable to full time employees as they
have standard hours so I would like to make the check box unavailable
for those who answer full time.

Please help - I need this done by Tuesday!!