Using FORMCHECKBOX field. Unable to get the value back.

  • Thread starter Thread starter Garette
  • Start date Start date
G

Garette

Good morning,

I work with Word 2002.
I insert a check box in a document : a {FORMCHECKBOX}field from "From"
toolbar.

If I use a {FORMDROPDOWN} or a {FORMTEXT} field, I can insert the result of
the dropdown list or the textbox by inserting in the document a {REF
MyDropDownList} or a {REF MyTextBox}field (where MyDropDownList and
MyTextBox are the List and Textbox bookmarks).
It works fine.

But if I do the same with a {FORMCHECKBOX}field when I insert a {REF
MyCheckBox}fiels (where MyCheckBox is the Checkbox bookmark) it doesn't
work.
Nothing appear when I uncheck "see field codes" option and I protec the
form.
I can't test it with a "IF" or "COMPARE" field.

Any ideas ?

Thanks for your Help
Lionel
 
What exactly are you wanting to do?

If it is to have a second checkbox displaying the same state as the other
one, then use a macro on exit from the first one that contains the following
code

With ActiveDocument
.FormFields("Check2").Checkbox.Value =
..FormFields("Check1").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
 
I want to do something like :
{ IF {COMPARE { REF MyCheckBox } = 1 } = 1 "Message when the box is
checked" "Message when the box is not checked"}



It works fine with a TextBox :

{ IF {COMPARE { REF Text1 } = "Yes" } = 1 "Yes" "No"}

If I hit "Yes" in the TextBox I get "Yes"

If I hit any other thing in the TextBox I get "No"



More generally, I am wondering why it is possible to get the value from
FORMTEXT and FORMDROPDOWN and not from FORMCHECKBOX.

When evaluating (SHIFT + F9) the { REF MyCheckBox }field I get nothing (no
error but nothing)



Thanks for the Macro example you gave.
 
Garette,

That is just the way it is. You could evaluate the state of the
checkbox and set a document variable then use that variable in your IF
field:

Sub EvalCB()
Dim oFF As FormFields
With ActiveDocument
If .FormFields("Check1").CheckBox.Value = True Then
.Variables("oVar").Value = "True"
Else
.Variables("oVar").Value = "False"
End If
.Fields.Update
End With
End Sub

{IF {DocVariable oVar} = "True""State A""State B"}
 
Thank you very much for your help.
Garette.


"Greg Maxey" <[email protected]> a écrit dans le message de (e-mail address removed)...
Garette,

That is just the way it is. You could evaluate the state of the
checkbox and set a document variable then use that variable in your IF
field:

Sub EvalCB()
Dim oFF As FormFields
With ActiveDocument
If .FormFields("Check1").CheckBox.Value = True Then
.Variables("oVar").Value = "True"
Else
.Variables("oVar").Value = "False"
End If
.Fields.Update
End With
End Sub

{IF {DocVariable oVar} = "True""State A""State B"}
 

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

Back
Top