Setting Checkboxes

N

nicaboyne

I have two sets of two checkboxes. The first set, checkbox1 and Checkbox2
have scripts to make them mutually exclusive.

Checkbox11 and checkbox12 are not active, but are set by how Checkbox1 and
checkbox2 are set. So when checkbox1 is true, checkbox11 is true, and when
Checkbox2 is true Checkbox12 is true.

The problem is the code to set Checkbox11 and Checkbox12 to false does not
execute. if I select checkbox1, checkbox11 does become true. But if I then
select Checkbox1 again to make it false, checkbox11 does not become false, it
remains true.

Here is the code I am using to do this:

Sub EnterCheck1()
With ActiveDocument
.FormFields("Checkbox11").CheckBox.Value = False
.FormFields("Checkbox12").CheckBox.Value = False
If .FormFields("Checkbox1").CheckBox.Value = True Then

.FormFields("Checkbox2").CheckBox.Value = False
.FormFields("Checkbox11").CheckBox.Value = True
End If
End With
End Sub

Is unselecting a checkbox a different event, or is there a problem in my
logic?
 
D

Doug Robbins - Word MVP

Use:

With ActiveDocument
.FormFields("Check11").CheckBox.Value =
..FormFields("Check1").CheckBox.Value
.FormFields("Check12").CheckBox.Value =
..FormFields("Check2").CheckBox.Value
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jan Hyde (VB MVP)

nicaboyne <[email protected]>'s wild
thoughts were released on Thu, 9 Oct 2008 14:47:01 -0700
bearing the following fruit:
I have two sets of two checkboxes. The first set, checkbox1 and Checkbox2
have scripts to make them mutually exclusive.

Why aren't they option buttons instead? Then your problem
wouldn't exist and users won't be confused.

J
 

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