EPamperin12
New Member
- Joined
- Jan 8, 2008
- Messages
- 47
I have a form on Microsoft Word. I have 72 Differnet Questions that have FormField Checkboxes. I am wanting a better way to program each question to make sure 1 and only 1 checkbox was selected for each question. Some of my questions have numerous choices (up to 26).
I have something that works, but it is probably not the best way to program it. and would like some help.
This is not bad for 2 or 3 options but I have some that are 26 different options. Any help on a way to shrink this code down would be most helpful.
Thank you.
I have something that works, but it is probably not the best way to program it. and would like some help.
Code:
Sub CheckQuestion1()
Dim oDoc As Document
Dim oFFs As FormFields
Dim oRng As String
Set oDoc = ActiveDocument
Set oFFs = oDoc.FormFields
If oFFs("K70").CheckBox.Value = False _
And oFFs("K71").CheckBox.Value = False _
and oFFs("K72").CheckBox.Value = False Then
Error.Label1 = "Please Select at least 1"
Error.show
offs("K70").Select
End if
If oFFs("K70").CheckBox.Value = True _
if oFFs("K71").CheckBox.Value = False then
or oFFs("K72").CheckBox.Value = False Then
Error.Label1 = "Please Select at least 1"
End if
Elseif oFFs("K71").CheckBox.Value = False then
if oFFs("K72").CheckBox.Value = False Then
Error.Label1 = "Please Select at least 1"
End if
Else
End if
End Sub
This is not bad for 2 or 3 options but I have some that are 26 different options. Any help on a way to shrink this code down would be most helpful.
Thank you.