Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Anderflash Anderflash is offline
external usenet poster
 
Posts: 26
Default Use Check Box field value in a form

We can use the fields' bookmarks to get the value, like the text boxes
"Text1" and "Text2" (I can put { ref Text1} or simply {Text1} to get the
Bookmark value). But how do I use this for a check box field's bookmark? If I
have "Check1" as a Check box field bookmark and I put {Check1} or {ref
Check1} I don't get the value of the check box field.
I'd want to get the value (I don't know if is True/False or 1/0 or -1/0...)
and put it in a {IF...} field.

OBS: without using VBA directly, because is easy with this mode.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Use Check Box field value in a form

I don't think you can do this without vba - however it is simple enough. Run
the following macro on exit from the Check1 field

Sub Checked()
If ActiveDocument.FormFields("Check1").CheckBox.Value = True Then
For Each aVar In ActiveDocument.Variables
If aVar.Name = "sCheck1" Then num = aVar.Index
Next aVar
If num = 0 Then
ActiveDocument.Variables.Add Name:="sCheck1", Value:=1
Else
ActiveDocument.Variables(num).Value = 1
End If
End If

If ActiveDocument.FormFields("Check1").CheckBox.Value = False Then
For Each aVar In ActiveDocument.Variables
If aVar.Name = "sCheck1" Then num = aVar.Index
Next aVar
If num = 0 Then
ActiveDocument.Variables.Add Name:="sCheck1", Value:=0
Else
ActiveDocument.Variables(num).Value = 0
End If
End If
End Sub

This creates a docvariable called sCheck1 which will have the value 1 for
true or 0 for false (or any other values you assign)

You can use that variable in a conditional field eg
{ IF{ DOCVARIABLE sCheck1 } = 1 "True" "False"}

--

Graham Mayor - Word MVP

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


Anderflash wrote:
We can use the fields' bookmarks to get the value, like the text boxes
"Text1" and "Text2" (I can put { ref Text1} or simply {Text1} to get
the Bookmark value). But how do I use this for a check box field's
bookmark? If I have "Check1" as a Check box field bookmark and I put
{Check1} or {ref Check1} I don't get the value of the check box field.
I'd want to get the value (I don't know if is True/False or 1/0 or
-1/0...) and put it in a {IF...} field.

OBS: without using VBA directly, because is easy with this mode.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
check box form field disappears matthew_12345678 Microsoft Word Help 2 July 26th 06 05:02 PM
when i put a field (check box) into my form it didn't work - why? Summer Flower Microsoft Word Help 4 July 22nd 06 06:50 PM
text form field and spaces phillip9 Microsoft Word Help 4 January 18th 06 11:54 PM
Can I spell check a form field Cbarton Microsoft Word Help 1 May 4th 05 04:45 AM
check box form field, how do I "check" using Enter Key robanddawnmc Microsoft Word Help 4 April 6th 05 11:11 PM


All times are GMT +1. The time now is 09:08 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"