Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
kmewing kmewing is offline
external usenet poster
 
Posts: 21
Default Calculations in text form fields

I did a search of the forum on this topic and didnt find anything that
answered my question.

Im using Word 2007 but this also needs to work with 2003. I am revamping a
form that uses text form fields. Several of the fields are drop-downs where
you can choose a number (1, 2, 3, or 4). Another field is supposed to sum
the numbers from all the drop-downs.

I cannot get this operation to work. No matter how I configure the text
fields, the summation field just says zero.

Heres how Ive configured things. First, the drop-downs (assume three) are
just created normally (default settings). Second, the summation field is
configured as follows (in the Text Form Field Options dialog box):

Type: Calculation
Expression: =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bo okmark3
Maximum length: Unlimited (default value)
All other fields blank.
€śCalculate on exit€ť is selected.

A colleague did some hacking and got the summation to work by making the
following changes in the Text Form Field Options dialog box:

Change the drop-downs to regular text form fields and set the Type to
Number.
In the summation field, enclose the Expression in parentheses, as in:
=(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3)
In the summation field, clear the text in the Bookmark field.

I could go this route, but I would prefer to keep the drop-downs if
possible. Does anyone have any advice? Thanks.

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Calculations in text form fields

Hi kmewing,

First off, make sure you're using the 'legacy' dropdown formfields.

Next, with each dropdown formfield, make sure its properties include a bookmark name (eg DropDown1, DropDown2, DropDown3,
DropDown4,) and that it is set to 'calculate on exit'.

Then, where you want the calculation to go, press Ctrl-F9 to create a formula field coded as:
{=DropDown1+DropDown2+DropDown3+DropDown4}

You can also add formatting switches to the formula field - eg:
{=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)}
for whole numbers, with brackets around negative values
{=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00}
for currency with a thousands separator

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message ...
I did a search of the forum on this topic and didnt find anything that
answered my question.

Im using Word 2007 but this also needs to work with 2003. I am revamping a
form that uses text form fields. Several of the fields are drop-downs where
you can choose a number (1, 2, 3, or 4). Another field is supposed to sum
the numbers from all the drop-downs.

I cannot get this operation to work. No matter how I configure the text
fields, the summation field just says zero.

Heres how Ive configured things. First, the drop-downs (assume three) are
just created normally (default settings). Second, the summation field is
configured as follows (in the Text Form Field Options dialog box):

Type: Calculation
Expression: =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bo okmark3
Maximum length: Unlimited (default value)
All other fields blank.
€śCalculate on exit€ť is selected.

A colleague did some hacking and got the summation to work by making the
following changes in the Text Form Field Options dialog box:

Change the drop-downs to regular text form fields and set the Type to
Number.
In the summation field, enclose the Expression in parentheses, as in:
=(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3)
In the summation field, clear the text in the Bookmark field.

I could go this route, but I would prefer to keep the drop-downs if
possible. Does anyone have any advice? Thanks.


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
kmewing kmewing is offline
external usenet poster
 
Posts: 21
Default Calculations in text form fields

Thanks for the suggestions. I set up the file exactly as you described but I
still get the same behavior. The result field just shows zero regardless of
what values are entered into the drop-downs.


"macropod" wrote:

Hi kmewing,

First off, make sure you're using the 'legacy' dropdown formfields.

Next, with each dropdown formfield, make sure its properties include a bookmark name (eg DropDown1, DropDown2, DropDown3,
DropDown4,) and that it is set to 'calculate on exit'.

Then, where you want the calculation to go, press Ctrl-F9 to create a formula field coded as:
{=DropDown1+DropDown2+DropDown3+DropDown4}

You can also add formatting switches to the formula field - eg:
{=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)}
for whole numbers, with brackets around negative values
{=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00}
for currency with a thousands separator

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message ...
I did a search of the forum on this topic and didnt find anything that
answered my question.

Im using Word 2007 but this also needs to work with 2003. I am revamping a
form that uses text form fields. Several of the fields are drop-downs where
you can choose a number (1, 2, 3, or 4). Another field is supposed to sum
the numbers from all the drop-downs.

I cannot get this operation to work. No matter how I configure the text
fields, the summation field just says zero.

Heres how Ive configured things. First, the drop-downs (assume three) are
just created normally (default settings). Second, the summation field is
configured as follows (in the Text Form Field Options dialog box):

Type: Calculation
Expression: =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bo okmark3
Maximum length: Unlimited (default value)
All other fields blank.
€śCalculate on exit€ť is selected.

A colleague did some hacking and got the summation to work by making the
following changes in the Text Form Field Options dialog box:

Change the drop-downs to regular text form fields and set the Type to
Number.
In the summation field, enclose the Expression in parentheses, as in:
=(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3)
In the summation field, clear the text in the Bookmark field.

I could go this route, but I would prefer to keep the drop-downs if
possible. Does anyone have any advice? Thanks.



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Calculations in text form fields

Hi kmewing,

Have you protected the document for forms? If so, and you've follwed the previous directions exactly, it should work. The only other
thing I can think of that would prevent it working is if you've got mergefields (for a mailmerge) embedded in the same document.

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message ...
Thanks for the suggestions. I set up the file exactly as you described but I
still get the same behavior. The result field just shows zero regardless of
what values are entered into the drop-downs.


"macropod" wrote:

Hi kmewing,

First off, make sure you're using the 'legacy' dropdown formfields.

Next, with each dropdown formfield, make sure its properties include a bookmark name (eg DropDown1, DropDown2, DropDown3,
DropDown4,) and that it is set to 'calculate on exit'.

Then, where you want the calculation to go, press Ctrl-F9 to create a formula field coded as:
{=DropDown1+DropDown2+DropDown3+DropDown4}

You can also add formatting switches to the formula field - eg:
{=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)}
for whole numbers, with brackets around negative values
{=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00}
for currency with a thousands separator

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message ...
I did a search of the forum on this topic and didnt find anything that
answered my question.

Im using Word 2007 but this also needs to work with 2003. I am revamping a
form that uses text form fields. Several of the fields are drop-downs where
you can choose a number (1, 2, 3, or 4). Another field is supposed to sum
the numbers from all the drop-downs.

I cannot get this operation to work. No matter how I configure the text
fields, the summation field just says zero.

Heres how Ive configured things. First, the drop-downs (assume three) are
just created normally (default settings). Second, the summation field is
configured as follows (in the Text Form Field Options dialog box):

Type: Calculation
Expression: =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bo okmark3
Maximum length: Unlimited (default value)
All other fields blank.
€śCalculate on exit€ť is selected.

A colleague did some hacking and got the summation to work by making the
following changes in the Text Form Field Options dialog box:

Change the drop-downs to regular text form fields and set the Type to
Number.
In the summation field, enclose the Expression in parentheses, as in:
=(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3)
In the summation field, clear the text in the Bookmark field.

I could go this route, but I would prefer to keep the drop-downs if
possible. Does anyone have any advice? Thanks.




  #5   Report Post  
Posted to microsoft.public.word.docmanagement
kmewing kmewing is offline
external usenet poster
 
Posts: 21
Default Calculations in text form fields

Yes, I enabled protection. In fact, I created a test document just to test
this functionality. I opened a pristine new document, and the only text I
inserted is the text form fields, so there is no other text or functionality
embedded in this document to interfere.

There must be a reason why this isn't working but I just don't see it. At
the very least, this discussion has shown that the problem is not due to some
glaring, obvious omission. Thanks for your time nonetheless.

Ken


"macropod" wrote:

Hi kmewing,

Have you protected the document for forms? If so, and you've follwed the previous directions exactly, it should work. The only other
thing I can think of that would prevent it working is if you've got mergefields (for a mailmerge) embedded in the same document.

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message ...
Thanks for the suggestions. I set up the file exactly as you described but I
still get the same behavior. The result field just shows zero regardless of
what values are entered into the drop-downs.


"macropod" wrote:

Hi kmewing,

First off, make sure you're using the 'legacy' dropdown formfields.

Next, with each dropdown formfield, make sure its properties include a bookmark name (eg DropDown1, DropDown2, DropDown3,
DropDown4,) and that it is set to 'calculate on exit'.

Then, where you want the calculation to go, press Ctrl-F9 to create a formula field coded as:
{=DropDown1+DropDown2+DropDown3+DropDown4}

You can also add formatting switches to the formula field - eg:
{=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)}
for whole numbers, with brackets around negative values
{=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00}
for currency with a thousands separator

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message ...
I did a search of the forum on this topic and didnt find anything that
answered my question.

Im using Word 2007 but this also needs to work with 2003. I am revamping a
form that uses text form fields. Several of the fields are drop-downs where
you can choose a number (1, 2, 3, or 4). Another field is supposed to sum
the numbers from all the drop-downs.

I cannot get this operation to work. No matter how I configure the text
fields, the summation field just says zero.

Heres how Ive configured things. First, the drop-downs (assume three) are
just created normally (default settings). Second, the summation field is
configured as follows (in the Text Form Field Options dialog box):

Type: Calculation
Expression: =Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bo okmark3
Maximum length: Unlimited (default value)
All other fields blank.
€śCalculate on exit€ť is selected.

A colleague did some hacking and got the summation to work by making the
following changes in the Text Form Field Options dialog box:

Change the drop-downs to regular text form fields and set the Type to
Number.
In the summation field, enclose the Expression in parentheses, as in:
=(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3)
In the summation field, clear the text in the Bookmark field.

I could go this route, but I would prefer to keep the drop-downs if
possible. Does anyone have any advice? Thanks.







  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Calculations in text form fields

You cannot do calculations directly with DropDown formfields, but must use a
macro that runs on exit.

Dim dd1 As Long, dd2 As Long
With ActiveDocument
dd1 = .FormFields("Dropdown1").DropDown.Value
dd2 = .FormFields("Dropdown2").DropDown.Value
.FormFields("Text1").result =
Val(.FormFields("Dropdown1").DropDown.ListEntries( dd1).Name) + _
Val(.FormFields("Dropdown1").DropDown.ListEntries( dd2).Name)
End With

Make sure that your formfield that is to show the result is NOT set to a
Calculation type formfield. It must be of type "Regular Text"

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

"kmewing" wrote in message
...
Yes, I enabled protection. In fact, I created a test document just to
test
this functionality. I opened a pristine new document, and the only text I
inserted is the text form fields, so there is no other text or
functionality
embedded in this document to interfere.

There must be a reason why this isn't working but I just don't see it. At
the very least, this discussion has shown that the problem is not due to
some
glaring, obvious omission. Thanks for your time nonetheless.

Ken


"macropod" wrote:

Hi kmewing,

Have you protected the document for forms? If so, and you've follwed the
previous directions exactly, it should work. The only other
thing I can think of that would prevent it working is if you've got
mergefields (for a mailmerge) embedded in the same document.

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message
...
Thanks for the suggestions. I set up the file exactly as you described
but I
still get the same behavior. The result field just shows zero
regardless of
what values are entered into the drop-downs.


"macropod" wrote:

Hi kmewing,

First off, make sure you're using the 'legacy' dropdown formfields.

Next, with each dropdown formfield, make sure its properties include a
bookmark name (eg DropDown1, DropDown2, DropDown3,
DropDown4,) and that it is set to 'calculate on exit'.

Then, where you want the calculation to go, press Ctrl-F9 to create a
formula field coded as:
{=DropDown1+DropDown2+DropDown3+DropDown4}

You can also add formatting switches to the formula field - eg:
{=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)}
for whole numbers, with brackets around negative values
{=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00}
for currency with a thousands separator

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message
...
I did a search of the forum on this topic and didn't find anything
that
answered my question.

I'm using Word 2007 but this also needs to work with 2003. I am
revamping a
form that uses text form fields. Several of the fields are
drop-downs where
you can choose a number (1, 2, 3, or 4). Another field is supposed
to sum
the numbers from all the drop-downs.

I cannot get this operation to work. No matter how I configure the
text
fields, the summation field just says zero.

Here's how I've configured things. First, the drop-downs (assume
three) are
just created normally (default settings). Second, the summation
field is
configured as follows (in the Text Form Field Options dialog box):

Type: Calculation
Expression:
=Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bo okmark3
Maximum length: Unlimited (default value)
All other fields blank.
"Calculate on exit" is selected.

A colleague did some hacking and got the summation to work by making
the
following changes in the Text Form Field Options dialog box:

Change the drop-downs to regular text form fields and set the Type
to
Number.
In the summation field, enclose the Expression in parentheses, as
in:
=(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3)
In the summation field, clear the text in the Bookmark field.

I could go this route, but I would prefer to keep the drop-downs if
possible. Does anyone have any advice? Thanks.







  #7   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Calculations in text form fields

You cannot do calculations directly with DropDown formfields
Oops!

--
Cheers
macropod
[MVP - Microsoft Word]


"Doug Robbins - Word MVP" wrote in message ...
You cannot do calculations directly with DropDown formfields, but must use a
macro that runs on exit.

Dim dd1 As Long, dd2 As Long
With ActiveDocument
dd1 = .FormFields("Dropdown1").DropDown.Value
dd2 = .FormFields("Dropdown2").DropDown.Value
.FormFields("Text1").result =
Val(.FormFields("Dropdown1").DropDown.ListEntries( dd1).Name) + _
Val(.FormFields("Dropdown1").DropDown.ListEntries( dd2).Name)
End With

Make sure that your formfield that is to show the result is NOT set to a
Calculation type formfield. It must be of type "Regular Text"

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

"kmewing" wrote in message
...
Yes, I enabled protection. In fact, I created a test document just to
test
this functionality. I opened a pristine new document, and the only text I
inserted is the text form fields, so there is no other text or
functionality
embedded in this document to interfere.

There must be a reason why this isn't working but I just don't see it. At
the very least, this discussion has shown that the problem is not due to
some
glaring, obvious omission. Thanks for your time nonetheless.

Ken


"macropod" wrote:

Hi kmewing,

Have you protected the document for forms? If so, and you've follwed the
previous directions exactly, it should work. The only other
thing I can think of that would prevent it working is if you've got
mergefields (for a mailmerge) embedded in the same document.

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message
...
Thanks for the suggestions. I set up the file exactly as you described
but I
still get the same behavior. The result field just shows zero
regardless of
what values are entered into the drop-downs.


"macropod" wrote:

Hi kmewing,

First off, make sure you're using the 'legacy' dropdown formfields.

Next, with each dropdown formfield, make sure its properties include a
bookmark name (eg DropDown1, DropDown2, DropDown3,
DropDown4,) and that it is set to 'calculate on exit'.

Then, where you want the calculation to go, press Ctrl-F9 to create a
formula field coded as:
{=DropDown1+DropDown2+DropDown3+DropDown4}

You can also add formatting switches to the formula field - eg:
{=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)}
for whole numbers, with brackets around negative values
{=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00}
for currency with a thousands separator

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message
...
I did a search of the forum on this topic and didn't find anything
that
answered my question.

I'm using Word 2007 but this also needs to work with 2003. I am
revamping a
form that uses text form fields. Several of the fields are
drop-downs where
you can choose a number (1, 2, 3, or 4). Another field is supposed
to sum
the numbers from all the drop-downs.

I cannot get this operation to work. No matter how I configure the
text
fields, the summation field just says zero.

Here's how I've configured things. First, the drop-downs (assume
three) are
just created normally (default settings). Second, the summation
field is
configured as follows (in the Text Form Field Options dialog box):

Type: Calculation
Expression:
=Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bo okmark3
Maximum length: Unlimited (default value)
All other fields blank.
"Calculate on exit" is selected.

A colleague did some hacking and got the summation to work by making
the
following changes in the Text Form Field Options dialog box:

Change the drop-downs to regular text form fields and set the Type
to
Number.
In the summation field, enclose the Expression in parentheses, as
in:
=(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3)
In the summation field, clear the text in the Bookmark field.

I could go this route, but I would prefer to keep the drop-downs if
possible. Does anyone have any advice? Thanks.







  #8   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Calculations in text form fields

Actually, you CAN do calculations directly with DropDown formfields - I merely had the syntax wrong. It should have been:
{={REF DropDown1}+{REF DropDown2}+{REF DropDown3}+{REF DropDown4}}
where the field braces (ie '{ }') are created in pairs via Ctrl-F9.

--
Cheers
macropod
[MVP - Microsoft Word]


"Doug Robbins - Word MVP" wrote in message ...
You cannot do calculations directly with DropDown formfields, but must use a
macro that runs on exit.

Dim dd1 As Long, dd2 As Long
With ActiveDocument
dd1 = .FormFields("Dropdown1").DropDown.Value
dd2 = .FormFields("Dropdown2").DropDown.Value
.FormFields("Text1").result =
Val(.FormFields("Dropdown1").DropDown.ListEntries( dd1).Name) + _
Val(.FormFields("Dropdown1").DropDown.ListEntries( dd2).Name)
End With

Make sure that your formfield that is to show the result is NOT set to a
Calculation type formfield. It must be of type "Regular Text"

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

"kmewing" wrote in message
...
Yes, I enabled protection. In fact, I created a test document just to
test
this functionality. I opened a pristine new document, and the only text I
inserted is the text form fields, so there is no other text or
functionality
embedded in this document to interfere.

There must be a reason why this isn't working but I just don't see it. At
the very least, this discussion has shown that the problem is not due to
some
glaring, obvious omission. Thanks for your time nonetheless.

Ken


"macropod" wrote:

Hi kmewing,

Have you protected the document for forms? If so, and you've follwed the
previous directions exactly, it should work. The only other
thing I can think of that would prevent it working is if you've got
mergefields (for a mailmerge) embedded in the same document.

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message
...
Thanks for the suggestions. I set up the file exactly as you described
but I
still get the same behavior. The result field just shows zero
regardless of
what values are entered into the drop-downs.


"macropod" wrote:

Hi kmewing,

First off, make sure you're using the 'legacy' dropdown formfields.

Next, with each dropdown formfield, make sure its properties include a
bookmark name (eg DropDown1, DropDown2, DropDown3,
DropDown4,) and that it is set to 'calculate on exit'.

Then, where you want the calculation to go, press Ctrl-F9 to create a
formula field coded as:
{=DropDown1+DropDown2+DropDown3+DropDown4}

You can also add formatting switches to the formula field - eg:
{=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)}
for whole numbers, with brackets around negative values
{=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00}
for currency with a thousands separator

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message
...
I did a search of the forum on this topic and didn't find anything
that
answered my question.

I'm using Word 2007 but this also needs to work with 2003. I am
revamping a
form that uses text form fields. Several of the fields are
drop-downs where
you can choose a number (1, 2, 3, or 4). Another field is supposed
to sum
the numbers from all the drop-downs.

I cannot get this operation to work. No matter how I configure the
text
fields, the summation field just says zero.

Here's how I've configured things. First, the drop-downs (assume
three) are
just created normally (default settings). Second, the summation
field is
configured as follows (in the Text Form Field Options dialog box):

Type: Calculation
Expression:
=Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bo okmark3
Maximum length: Unlimited (default value)
All other fields blank.
"Calculate on exit" is selected.

A colleague did some hacking and got the summation to work by making
the
following changes in the Text Form Field Options dialog box:

Change the drop-downs to regular text form fields and set the Type
to
Number.
In the summation field, enclose the Expression in parentheses, as
in:
=(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3)
In the summation field, clear the text in the Bookmark field.

I could go this route, but I would prefer to keep the drop-downs if
possible. Does anyone have any advice? Thanks.







  #9   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Calculations in text form fields

Ah, but is that directly?

It's really splitting hairs, but you are using a reference to the dropdowns.

Still, it is less work than a macro

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

"macropod" wrote in message
...
Actually, you CAN do calculations directly with DropDown formfields - I
merely had the syntax wrong. It should have been:
{={REF DropDown1}+{REF DropDown2}+{REF DropDown3}+{REF DropDown4}}
where the field braces (ie '{ }') are created in pairs via Ctrl-F9.

--
Cheers
macropod
[MVP - Microsoft Word]


"Doug Robbins - Word MVP" wrote in message
...
You cannot do calculations directly with DropDown formfields, but must
use a macro that runs on exit.

Dim dd1 As Long, dd2 As Long
With ActiveDocument
dd1 = .FormFields("Dropdown1").DropDown.Value
dd2 = .FormFields("Dropdown2").DropDown.Value
.FormFields("Text1").result =
Val(.FormFields("Dropdown1").DropDown.ListEntries( dd1).Name) + _
Val(.FormFields("Dropdown1").DropDown.ListEntries( dd2).Name)
End With

Make sure that your formfield that is to show the result is NOT set to a
Calculation type formfield. It must be of type "Regular Text"

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

"kmewing" wrote in message
...
Yes, I enabled protection. In fact, I created a test document just to
test
this functionality. I opened a pristine new document, and the only text
I
inserted is the text form fields, so there is no other text or
functionality
embedded in this document to interfere.

There must be a reason why this isn't working but I just don't see it.
At
the very least, this discussion has shown that the problem is not due to
some
glaring, obvious omission. Thanks for your time nonetheless.

Ken


"macropod" wrote:

Hi kmewing,

Have you protected the document for forms? If so, and you've follwed
the previous directions exactly, it should work. The only other
thing I can think of that would prevent it working is if you've got
mergefields (for a mailmerge) embedded in the same document.

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message
...
Thanks for the suggestions. I set up the file exactly as you
described but I
still get the same behavior. The result field just shows zero
regardless of
what values are entered into the drop-downs.


"macropod" wrote:

Hi kmewing,

First off, make sure you're using the 'legacy' dropdown formfields.

Next, with each dropdown formfield, make sure its properties include
a bookmark name (eg DropDown1, DropDown2, DropDown3,
DropDown4,) and that it is set to 'calculate on exit'.

Then, where you want the calculation to go, press Ctrl-F9 to create
a formula field coded as:
{=DropDown1+DropDown2+DropDown3+DropDown4}

You can also add formatting switches to the formula field - eg:
{=DropDown1+DropDown2+DropDown3+DropDown4 \# 0;(0)}
for whole numbers, with brackets around negative values
{=DropDown1+DropDown2+DropDown3+DropDown4 \# $,0.00}
for currency with a thousands separator

--
Cheers
macropod
[MVP - Microsoft Word]


"kmewing" wrote in message
...
I did a search of the forum on this topic and didn't find anything
that
answered my question.

I'm using Word 2007 but this also needs to work with 2003. I am
revamping a
form that uses text form fields. Several of the fields are
drop-downs where
you can choose a number (1, 2, 3, or 4). Another field is
supposed to sum
the numbers from all the drop-downs.

I cannot get this operation to work. No matter how I configure
the text
fields, the summation field just says zero.

Here's how I've configured things. First, the drop-downs (assume
three) are
just created normally (default settings). Second, the summation
field is
configured as follows (in the Text Form Field Options dialog box):

Type: Calculation
Expression:
=Dropdown_bookmark1+Dropdown_bookmark2+Dropdown_bo okmark3
Maximum length: Unlimited (default value)
All other fields blank.
"Calculate on exit" is selected.

A colleague did some hacking and got the summation to work by
making the
following changes in the Text Form Field Options dialog box:

Change the drop-downs to regular text form fields and set the Type
to
Number.
In the summation field, enclose the Expression in parentheses, as
in:
=(Textfield_bookmark1+Textfield _bookmark2+Textfield _bookmark3)
In the summation field, clear the text in the Bookmark field.

I could go this route, but I would prefer to keep the drop-downs
if
possible. Does anyone have any advice? 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
Calculations in Form Fields not working Jeff Doby Microsoft Word Help 2 March 28th 08 08:10 PM
Text Form Calculations Jose Cabral[_2_] Microsoft Word Help 1 March 7th 07 07:54 AM
Help! Form fields in table and calculations! R.P.McMurphy Microsoft Word Help 6 December 19th 05 01:38 PM
Calculations in form fields KathyHL Microsoft Word Help 1 June 18th 05 01:46 PM
How do I make a form in Word with fields that do calculations? KathyHL Microsoft Word Help 1 June 14th 05 03:11 PM


All times are GMT +1. The time now is 09:50 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"