How do you make sure only one field formis allowed to be ticked??

H

hollabackgirl26

Hi...I'm creating a form to be completed using Word, & I've entered the tick
box form fields in, but want to know how to let the person answering the
form, only tick one box out of so many boxes??

For example, one question is Male or Female....only want the person
answering to be able to tick one box!

Thanks very much for your help in advance!
 
J

Jay Freedman

You could use the macro solution at
http://www.word.mvps.org/FAQs/TblsFldsFms/ExclusiveFmFldChbxs.htm.

However, I think a dropdown form field would be a better solution, even if
it only has two items in it. Then you don't have to worry about whether the
user has disabled macros.

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

hollabackgirl26

Thanks for that!!!! Now I've got a new question....how do I record a macro
for my form?? I'm not too computer illiterate....but everything I'm tryin is
not likin it!!

Do you hve to record the macro at the bottom of the form in the same
document? How do you get to enter the code??

Sorry & thank you!!!
 
R

Rob

If you do it this way instead it will work like a toggle with the mouse, tab
or arrow keys.

Name one checkbox "chkMale", and put this sub as the entry AND exit macro:

Sub CheckMale()
If ActiveDocument.FormFields("chkMale").CheckBox.Value = True Then
ActiveDocument.FormFields("chkFemale").CheckBox.Value = False
End If
End Sub

Name the other checkbox "chkFemale" and put this sub as both the entry AND
exit macro:

Sub CheckFemale()
If ActiveDocument.FormFields("chkFemale").CheckBox.Value = True Then
ActiveDocument.FormFields("chkMale").CheckBox.Value = False
End If
End Sub
 
J

Jay Freedman

You can't record that macro; you copy it from the web page and paste it into
the VBA editor. Read the instructions at
http://www.gmayor.com/installing_macro.htm.

Also note that this stuff needs to be in a _template_ (*.dot file), not in a
_document_ (*.doc file) because macros in documents always run into the
macro security roadblock -- Word thinks that any document containing a macro
is likely to be a virus.

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