Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Mike
 
Posts: n/a
Default Form fields: IF (checkbox)?

I'm creating a word form, and need a field to be calculated differently
depending whether a checkbox is checked or not. I can't seem to get it
working. Here's what I've done:

I created three fields, a checkbox called "checkbox", and two number
fields called "initial" and "final". The user will enter a number in
"initial". If they check "checkbox", then "final" should be half of
"initial", otherwise it should equal "initial".

I set up "final" as a calculate field, with the following formula:

=IF (checkbox=true,initial/2,initial)

But, regardless of if the checkbox is checked or not, "final" always
winds up equalling "initial". Can you please tell me what needs to go
in the formula field to consider the state of the checkbox?

Thanks!

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP
 
Posts: n/a
Default Form fields: IF (checkbox)?

I don't think that you can do that with a calculation type checkbox (at
least I could not get it to work). You can however do it by having the
following macro run on exit from the Initial formfield and the checkbox
formfield with the Final formfield just set to a text type formfield

Dim Divisor as Long
If ActiveDocument.FormFields("check1").CheckBox.Value = True Then
Divisor = 2
Else
Divisor = 1
End If
ActiveDocument.FormFields("Final").result =
ActiveDocument.FormFields("Initial").result / Divisor


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

"Mike" wrote in message
oups.com...
I'm creating a word form, and need a field to be calculated differently
depending whether a checkbox is checked or not. I can't seem to get it
working. Here's what I've done:

I created three fields, a checkbox called "checkbox", and two number
fields called "initial" and "final". The user will enter a number in
"initial". If they check "checkbox", then "final" should be half of
"initial", otherwise it should equal "initial".

I set up "final" as a calculate field, with the following formula:

=IF (checkbox=true,initial/2,initial)

But, regardless of if the checkbox is checked or not, "final" always
winds up equalling "initial". Can you please tell me what needs to go
in the formula field to consider the state of the checkbox?

Thanks!



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
macropod
 
Posts: n/a
Default Form fields: IF (checkbox)?

Hi Mike,

You can't use formfield checkbox states in other fields. As a workaround,
you could test for a Yes/No answer in a drop-down box (eg {IF{Dropdown1}=
"Yes" {=Initial/2} {Initial}})
where the braces (i.e. '{}') are created in pairs via Ctrl-F9. Note the
syntax and spacing.

Cheers

"Mike" wrote in message
oups.com...
I'm creating a word form, and need a field to be calculated differently
depending whether a checkbox is checked or not. I can't seem to get it
working. Here's what I've done:

I created three fields, a checkbox called "checkbox", and two number
fields called "initial" and "final". The user will enter a number in
"initial". If they check "checkbox", then "final" should be half of
"initial", otherwise it should equal "initial".

I set up "final" as a calculate field, with the following formula:

=IF (checkbox=true,initial/2,initial)

But, regardless of if the checkbox is checked or not, "final" always
winds up equalling "initial". Can you please tell me what needs to go
in the formula field to consider the state of the checkbox?

Thanks!



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
How to create listbox and checkbox in Word form Wellie Microsoft Word Help 1 April 25th 06 02:44 AM
Mail Merge and checkbox form fields Sotiris Mailmerge 1 February 10th 06 08:55 PM
mail merge and text form fields Miss Su Mailmerge 1 February 4th 06 09:29 PM
Default text shown in form fields Gitte Microsoft Word Help 1 January 2nd 06 03:16 PM
Hyperlink macro assigned to checkbox form field Jack_Feeman Microsoft Word Help 4 August 24th 05 09:06 AM


All times are GMT +1. The time now is 08:29 AM.

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"